a = gets.to_i (0 .. 100).each do |i| (3 .. 100).each do |j| if j * (i + j - 1) / 2 == a puts 'YES' exit end end end puts 'NO'