#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
ll n; cin >> n;
ll N = n*n;
set<ll> cnt = {0};
vector<int> A(4, 0);
for (ll i = 1; i < ll(6250000+5); i++){
ll I = i*i;
ll J = max(N, I)-min(N, I);
ll j = sqrtl(J);
if (j*j != J || cnt.count(j)) continue;
cnt.insert(i);
cnt.insert(j);
if (I+N == J || I+J == N || J+N == I){
int PPT = (gcd(i, j) == 1 && gcd(i, n) == 1 && gcd(j, n) == 1);
if (max({i, j, n}) == n) A[!PPT]++;
else A[(!PPT)+2]++;
}
}
for (int i: A) cout << i << " ";
cout << endl;
}
int main(){
cin.tie(0)->sync_with_stdio(0);
int t = 1;
// cin >> t;
while(t--){
solve();
}
}