#include using namespace std; using ll = long long; int main() { int n; cin >> n; int r = 0; ll t = n; t *= t; for (int i = 1; i < n; i++) { ll x = i; ll y = round(sqrt(t - x * x)); r += x * x + y * y == t; } cout << r << endl; return 0; }