N = gets.to_i ok = 10 ** 19 ng = 0 while (ok - ng).abs >= 2 n = (ok + ng) / 2 s = n * (1 + n) / 2 if N <= s ok = n else ng = n end end if ok * (ok + 1) / 2 == N puts 'YES' puts ok else puts 'NO' end