#include <iostream>
#include <map>

std::map<int, int> front, back; //前二つの和と後二つの和がそれぞれ何通りあるか

void makeSet(){
	//半分全列挙
	for(int i=0;i<=1000;++i){
		for(int j=0;j<=1000;++j){
			int k=i+j;
			if(front.find(k)==front.end()) front.insert(std::pair<int, int>(k, 1)); else ++front[k];
			if(back.find(k)==back.end()) back.insert(std::pair<int, int>(k, 1)); else ++back[k];
		}
	}
}

int solve(int n){
	int num=0;
	for(std::map<int, int>::iterator i=front.begin(); i!=front.end();++i){
		std::map<int, int>::iterator j=back.find(n-i->first);
		if(j!=back.end()) num+=i->second*j->second;
	}
	return num;
}

int main(){
	makeSet();

	while(true){
		int n;
		std::cin>>n;
		if(std::cin.eof()) break;
		
		std::cout<<solve(n)<<std::endl;
	}
	return 0;
}