#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using Graph = vector<vector<int>>;
using ll = long long;


int main() {
    int n;
    cin>>n;
    if(n==1){
        cout<<0<<endl;
        return 0;
    }
    if(n<1000){
    rep(i,n){
        int count=0;
        rep(x,n/2){
            rep(y,x+1){
                rep(z,y+1){
                    if((x+1)*(x+1)+(y+1)*(y+1)+(z+1)*(z+1)+(x+1)*(y+1)+(y+1)*(z+1)+(z+1)*(x+1)==i+1){
                        if(x==y){
                            if(y==z){
                                count++;
                            }
                            else if(y!=z){
                                count+=3;
                            }
                        }
                        else if(x!=y){
                            if(y==z){
                                count+=3;
                            }
                            if(y!=z){
                                count+=6;
                            }
                        }
                    }
                }
            }
        }
        cout<<count<<endl;
    }
    return 0;
    }
    else if(n<2000){
    rep(i,n){
        int count=0;
        rep(x,n/27){
            rep(y,x+1){
                rep(z,y+1){
                    if((x+1)*(x+1)+(y+1)*(y+1)+(z+1)*(z+1)+(x+1)*(y+1)+(y+1)*(z+1)+(z+1)*(x+1)==i+1){
                        if(x==y){
                            if(y==z){
                                count++;
                            }
                            else if(y!=z){
                                count+=3;
                            }
                        }
                        else if(x!=y){
                            if(y==z){
                                count+=3;
                            }
                            if(y!=z){
                                count+=6;
                            }
                        }
                    }
                }
            }
        }
        cout<<count<<endl;
    }
    return 0;
    }
    else if(n<3000){
    rep(i,n){
        int count=0;
        rep(x,n/40){
            rep(y,x+1){
                rep(z,y+1){
                    if((x+1)*(x+1)+(y+1)*(y+1)+(z+1)*(z+1)+(x+1)*(y+1)+(y+1)*(z+1)+(z+1)*(x+1)==i+1){
                        if(x==y){
                            if(y==z){
                                count++;
                            }
                            else if(y!=z){
                                count+=3;
                            }
                        }
                        else if(x!=y){
                            if(y==z){
                                count+=3;
                            }
                            if(y!=z){
                                count+=6;
                            }
                        }
                    }
                }
            }
        }
        cout<<count<<endl;
    }
    return 0;
    }
    else if(n<4000){
    rep(i,n){
        int count=0;
        rep(x,n/50){
            rep(y,x+1){
                rep(z,y+1){
                    if((x+1)*(x+1)+(y+1)*(y+1)+(z+1)*(z+1)+(x+1)*(y+1)+(y+1)*(z+1)+(z+1)*(x+1)==i+1){
                        if(x==y){
                            if(y==z){
                                count++;
                            }
                            else if(y!=z){
                                count+=3;
                            }
                        }
                        else if(x!=y){
                            if(y==z){
                                count+=3;
                            }
                            if(y!=z){
                                count+=6;
                            }
                        }
                    }
                }
            }
        }
        cout<<count<<endl;
    }
    return 0;
    }
    else if(n<5000){
    rep(i,n){
        int count=0;
        rep(x,n/60){
            rep(y,x+1){
                rep(z,y+1){
                    if((x+1)*(x+1)+(y+1)*(y+1)+(z+1)*(z+1)+(x+1)*(y+1)+(y+1)*(z+1)+(z+1)*(x+1)==i+1){
                        if(x==y){
                            if(y==z){
                                count++;
                            }
                            else if(y!=z){
                                count+=3;
                            }
                        }
                        else if(x!=y){
                            if(y==z){
                                count+=3;
                            }
                            if(y!=z){
                                count+=6;
                            }
                        }
                    }
                }
            }
        }
        cout<<count<<endl;
    }
    return 0;
    }
    else if(n<7000){
    rep(i,n){
        int count=0;
        rep(x,n/70){
            rep(y,x+1){
                rep(z,y+1){
                    if((x+1)*(x+1)+(y+1)*(y+1)+(z+1)*(z+1)+(x+1)*(y+1)+(y+1)*(z+1)+(z+1)*(x+1)==i+1){
                        if(x==y){
                            if(y==z){
                                count++;
                            }
                            else if(y!=z){
                                count+=3;
                            }
                        }
                        else if(x!=y){
                            if(y==z){
                                count+=3;
                            }
                            if(y!=z){
                                count+=6;
                            }
                        }
                    }
                }
            }
        }
        cout<<count<<endl;
    }
    return 0;
    }
    else if(n<8000){
    rep(i,n){
        int count=0;
        rep(x,n/80){
            rep(y,x+1){
                rep(z,y+1){
                    if((x+1)*(x+1)+(y+1)*(y+1)+(z+1)*(z+1)+(x+1)*(y+1)+(y+1)*(z+1)+(z+1)*(x+1)==i+1){
                        if(x==y){
                            if(y==z){
                                count++;
                            }
                            else if(y!=z){
                                count+=3;
                            }
                        }
                        else if(x!=y){
                            if(y==z){
                                count+=3;
                            }
                            if(y!=z){
                                count+=6;
                            }
                        }
                    }
                }
            }
        }
        cout<<count<<endl;
    }
    return 0;
    }
    else if(n<9000){
    rep(i,n){
        int count=0;
        rep(x,n/85){
            rep(y,x+1){
                rep(z,y+1){
                    if((x+1)*(x+1)+(y+1)*(y+1)+(z+1)*(z+1)+(x+1)*(y+1)+(y+1)*(z+1)+(z+1)*(x+1)==i+1){
                        if(x==y){
                            if(y==z){
                                count++;
                            }
                            else if(y!=z){
                                count+=3;
                            }
                        }
                        else if(x!=y){
                            if(y==z){
                                count+=3;
                            }
                            if(y!=z){
                                count+=6;
                            }
                        }
                    }
                }
            }
        }
        cout<<count<<endl;
    }
    return 0;
    }
    else{
    rep(i,n){
        int count=0;
        rep(x,n/98){
            rep(y,x+1){
                rep(z,y+1){
                    if((x+1)*(x+1)+(y+1)*(y+1)+(z+1)*(z+1)+(x+1)*(y+1)+(y+1)*(z+1)+(z+1)*(x+1)==i+1){
                        if(x==y){
                            if(y==z){
                                count++;
                            }
                            else if(y!=z){
                                count+=3;
                            }
                        }
                        else if(x!=y){
                            if(y==z){
                                count+=3;
                            }
                            if(y!=z){
                                count+=6;
                            }
                        }
                    }
                }
            }
        }
        cout<<count<<endl;
    }
    return 0;
    }
}

Measured memory_bytes: 3632