#include using namespace std; using ll=long long; constexpr ll mod=1e9+7; bool isSqr(ll a) { return a == round(sqrt(a))*round(sqrt(a)); } int main() { cin.tie(0); ios_base::sync_with_stdio(false); ll n, ans = 0; cin>>n; for (ll i = 1; i < n; ++i) { if (isSqr(n*n - i*i)) { ans++; } } cout << ans << "\n"; }