import std.conv; import std.stdio; import std.string : chomp; void main(string[] args) { ulong l = 1, r = 2000000001; auto x = readln.chomp.to!ulong; do { immutable m = (r - l) / 2 + l; immutable sum = m * (m + 1) / 2; if (sum < x) { l = m + 1; } else if (sum > x) { r = m; } else { writeln("YES\n", m); return; } } while (l < r); writeln("NO"); }