#include<bits/stdc++.h>
using namespace std;
long int n,a,ans;
vector <long int> ss1,aa;

int main(){

    while(scanf("%d",&n)!=EOF){

    //cin >> n;
    ans=0;
    ss1.clear();
    //aa.push_back(0);

    for(int i=0;i<=1000&&i<=n;i++){
        for(int j=0;j<=1000&&j<=n;j++){
            if(i+j<=n)ss1.push_back(i+j);
        }
    }
    sort(ss1.begin(),ss1.end());

    int cnt=ss1.size()-1;
    for(int i=0;i<ss1.size();i++){
        while(ss1[i]+ss1[cnt]>n)cnt--;
        for(int j=cnt;j>-1;j--){
        if(ss1[i]+ss1[j]==n)ans++;
        else break;
        }
    }

    cout << ans << endl;

    }

return 0;
}