import std.stdio, std.algorithm;

void main() {
    auto p = new long[2001];
    foreach (i; 0 .. 1001) foreach (j; 0 .. 1001)
        p[i + j]++;
    while (true) {
        if (stdin.eof) break;
        int N; scanf("%d\n", &N);
        long ans;
        foreach (i; 0 .. min(N, 2000) + 1) if (0 <= N - i && N - i <= 2000)
            ans += p[i] * p[N - i];
        writeln(ans);
    }
}