#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <cmath>
#include <stack>
#include <map>
#include <numeric>
#include <sstream>
#include <queue>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n); (i)++)
#define FOR(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define PUSH(n,v) for(int i=0; i<(n); i++) {int j; cin >> j; v.push_back(j);}
#define ALL(v) v.begin(), v.end()
#define print(s) cout << (s) << endl

int part(int y) {
    // how many pairs of (a,b) where a+b=y
    if (y < 0) return 0;
    if (y <= 1000) return y+1;
    if (y > 2000) return 0;
    // 1??? (???,1000) ~ (1000,???)
    return 2001-y;
}

void solve96(int n) {
    int cnt = 0;
    REP(i,1001) {
        REP(j,1001) {
            cnt += part(n - i - j);
        }
    }
    cout << cnt << endl;
}

int main() {
    int n;
    while(cin >> n) {
        solve96(n);
    }
    return 0;
}