#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;
        int x = 0;
        if(n>3000)x = n-3000;

        for(int i=x;i<1001&&i<=n;i++){
            //cout<<i<<"-"<<endl;
            int y = 0;
            if(n-i>2000)y = n-i-2000;

            for(int j=y;j<1001&&i+j<=n;j++){
                //cout<<j<<"--"<<endl;
                //if(n-i-j>=2001)continue;
                int z = 0;
                if(n-i-j>1000)z = n-i-j-1000;

                int zz = 1001;
                if(1001>n-i-j+1) zz = n-i-j+1;

                ans += zz-z;

            }
        }


        cout<<ans<<endl;

    }
    return 0;
}