#include #include #include #include using namespace std; template int maxReturn(T a, T b) {if (a > b) {return a;} else {return b;}} template int minReturn(T a, T b) {if (a < b) {return a;} else {return b;}} int main(void){ long long n, i, sheepCount; cin >> n; i = 1; sheepCount = 0; while(true) { sheepCount += i; if (sheepCount == n) { cout << "YES" << endl << i << endl; break; } if (sheepCount > n) { cout << "NO" << endl; break; } i++; } }