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

int main(){
	int n, count, array[2001];
	fill(array, array + 2001, 0);
	for(int a = 0; a <= 1000; a++)
		for(int b = 0; b <= 1000; b++)
			array[a + b]++;
	
	while(scanf("%d", &n) != EOF){
		count = 0;
		for(int i = 0; i <= n; i++){
			if(n - i > 2000) continue;
			if(i > 2000) break;
			count += array[i] * array[n - i];
		}
		printf("%d\n", count);
	}
	return 0;
}