#include #include #include #include #include #include #include #include using namespace std; typedef long long ll; ll N; template vector divs(T N) { vector ans; for (ll i = 1; i * i <= N; i++) { if (N % i == 0) { ans.push_back(i); if (i * i != N) ans.push_back(N / i); } } return ans; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << setprecision(10) << fixed; cin >> N; vector v = divs(N*N); int ans = 0; for(ll s : v){ for(ll sa : v){ if(N*N%(s*sa) != 0) continue; if(s <= sa) continue; ll sum = s-sa; ll prod = N*N/(s*sa); ll D = sum*sum-4*prod; ll sq = (ll)(sqrt(D)+0.1); if(sq*sq != D) continue; if((sum+sq)%2 != 0) continue; ll sb = (sum+sq)/2; ll sc = (sum-sq)/2; if(sa >= sb && sa >= sc) { ans++; } } } cout << ans << endl; }