#include #include #include #include #include #include #include #include #include #include #include #include #include #include #define INF 1e9 #define MAX_T 2000000000 using namespace std; typedef long long ll; typedef pair P; int n; int sheep(int t) { return t * (t + 1) / 2; } int my_binary_search(int l, int r) { if (r - l == 1) { int num_l = sheep(l); int num_r = sheep(r); if (num_l == n) return l; else if (num_r == n) return r; else return 0; } int c = (l + r) / 2; int num = sheep(c); if (num == n) { return c; } else if (num > n) { return my_binary_search(l, c); } else { return my_binary_search(c, r); } } int main() { cin >> n; int l = 0, r = 20; int ans = my_binary_search(l, r); if (ans == 0) cout << "NO" << endl; else { cout << "YES" << endl << ans << endl; } return 0; }