#include using namespace std; typedef long long ll; int main(){ ll n; cin >> n; set st; for (ll x=1; x<=n; x++){ st.insert(x*x); } ll ans = 0; for (ll y=1; y<=n; y++){ if (st.find(n*n-y*y) != st.end()){ ans++; } } cout << ans << '\n'; }