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

int main(){

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

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

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

    if(n<=2000){
    for(int i=ss1.size();i>-1;i--){
        if(ss1[i]==n){
            cnt=i;
            break;
            }
        }
    }else cnt=ss1.size();

    int t=cnt;
    for(int i=0;i<=t;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;
}