#include <cstdio>
#include <iostream>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)(n);i++)

int memo[1145];

int main() {
    rep(a, 1001) rep(b, 1001) memo[a+b]++;
    int n;
    while(~scanf("%d", &n)) {
        long long ans = 0;

        for(int c=0; c<=2000; c++) {
            if(n-c >= 0 and n-c <= 2000)
                ans += memo[c] * memo[n-c];
        }
        printf("%lld\n", ans);
    }

    return 0;
}