#include<iostream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
int main(){
    int n;
    while(cin>>n){
        int ans = 0;
        REP(i,1001){
            if(n-i>=3001)continue;
            if(i>n)break;
            REP(j,1001){
                if(n-i-j>=2001)continue;
                if(i+j>n)break;
                REP(k,1001){
                    if(n-i-j-k>=1001)continue;
                    if(i+j+k>n)break;
                    ans++;
                }
            }
        }


        cout<<ans<<endl;

    }
    return 0;
}