#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { long long n; cin >> n; long long ok = 1; long long ng = 2e9; while (ok+1 < ng) { long long x = (ok+ng)/2; if (x*(x+1) <= n*2) ok = x; else ng = x; } if (ok*(ok+1) == n*2) cout << "YES\n" << ok << endl; else cout << "NO" << endl; }