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

int main() {
	int n;
	while (cin >> n) {
		int sum = 0;
		
		for (int i = 0;i <= 1000;i++) {
			for (int j = 0;j <= 1000;j++) {
				int c = n - i - j;
				if (c >= 0 && c <= 2000) {
					int d = min(1000, c);
					int e = c - d;
					sum += (d - e + 1);
				}
			}
		}
		cout << sum << endl;
	}
	return 0;
}