#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pl;
typedef pair<ld,ld> pd;
typedef vector<ll> vl;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define G(x) ll x; cin >> x;
#define F(i, l, r) for (ll i = l; i < (r); ++i)
#define all(a) begin(a), end(a)
#define K first
#define V second
#define OK(i,j) i >= 0 && i < n && j >= 0 && j < m
#define NN 2000005
#define MM 5005
#define MOD 1000000007
ll count(ll a, ll b, ll c, ll d, ll target) {
ll num = 0;
for(ll sgna = 1; sgna <= 1; sgna += 2) {
ll aa = sgna*a;
for(ll sgnb = -1; sgnb <= 1; sgnb += 2) {
if(a == b) sgnb = sgna;
ll bb = sgnb*b;
for(ll sgnc = -1; sgnc <= 1; sgnc += 2) {
if(b == c) sgnc = sgnb;
ll cc = sgnc*c;
for(ll sgnd = -1; sgnd <= 1; sgnd += 2) {
if(c == d) sgnd = sgnc;
ll dd = sgnd*d;
if(aa + bb + cc + dd == target) {
num++;
// cout << aa << ' ' << bb << ' ' << cc << ' ' << dd << '\n';
}
if(c == d || d == 0) break;
}
if(b == c || c == 0) break;
}
if(a == b || b == 0) break;
}
if(a == 0) break;
}
return num;
}
void solve() {
ll n;
cin >> n;
if(n == 0) {
cout << 1 << '\n';
return;
}
ll c = 1;
while(c*c <= n) c++;
c--;
ll ans = 0;
for(ll i1=0; i1 <= c; i1++) {
for(ll i2=0; i2 <= i1; i2++) {
for(ll i3=0; i3 <= i2; i3++) {
for(ll i4=0; i4<= i3; i4++) {
ans += count(i1*i1,i2*i2,i3*i3,i4*i4,n);
}
}
}
}
cout << ans << '\n';
}
int main() {
cin.tie(0)->sync_with_stdio(0);
cout << fixed << setprecision(10);
// G(t);
// while(t--)
solve();
return 0;
}