/* Name: Author: xiaruize Date: */ #include<bits/stdc++.h> usingnamespace std; #define int long long #define ull unsigned long long #define ALL(a) (a).begin(), (a).end() #define pb push_back #define mk make_pair #define pii pair<int, int> #define pis pair<int, string> #define sec second #define fir first #define sz(a) int((a).size()) #define rep(i, x, y) for (int i = x; i <= y; i++) #define repp(i, x, y) for (int i = x; i >= y; i--) #define Yes cout << "Yes" << endl #define YES cout << "YES" << endl #define No cout << "No" << endl #define NO cout << "NO" << endl #define debug(x) cerr << #x << ": " << x << endl #define double long double constint INF = 0x3f3f3f3f; constint MOD = 1000000007; constint N = 2e5 + 10;
// bool st; int t; int n; // bool en;
boolcheck(int x, int k) { while (x) { if (x % k > 1) returnfalse; x /= k; } returntrue; }
intget(int x) { int l = 1, r = 1e6; while (l < r) { int mid = l + r + 1 >> 1; if (mid * mid * mid <= x) l = mid; else r = mid - 1; } return l; }
voidsolve() { cin >> n; if (n == 2) { cout << "1" << endl; return; } int x = sqrt(n); int y = get(n); int res = 0; for (int i = 2; i <= 1e5 && i * i * i * i <= n; i++) { if (check(n, i)) res++; } for (int i = max(2ll, x - 1000); i <= min(x + 1000, n - 2); i++) { if (i * i + i + 1 == n || i * i + 1 == n || i * i + i == n || i * i == n) res++; } for (int i = max(2ll, y - 1000); i <= min(y + 1000, n - 2); i++) { if (i * i * i + i * i + i + 1 == n || i * i * i + i * i + 1 == n || i * i * i + i * i + i == n || i * i * i + i * i == n || i * i * i + i + 1 == n || i * i * i + 1 == n || i * i * i + i == n || i * i * i == n) res++; } cout << res + 2 << endl; }