def sum(n) n*(n+1)/2 end n=gets.to_i l,r=1,n until l>r m=(l+r)/2 s=sum(m) if n==s puts "YES" puts m exit elsif n