#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>

using namespace std;

int ab[2050];

int main(void)
{
	int n;
	
	for (int a = 0; a <= 1000; a++){
		for (int b = 0; b <= 1000; b++){
			ab[a + b]++;
		}
	}

	while (cin >> n){
		if (cin.eof()) break;

		int ret = 0;
		for (int cd = 0; cd <= 2000; cd++){
			if (n - cd >= 0 && n - cd <= 2000){
				ret += ab[cd] * ab[n - cd];
			}
		}
		cout << ret << endl;
	}

	return 0;
}