#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
 
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define all(v) (v).begin(), (v).end()
#define rev(s) (s).rbegin(), (s).rend()
#define MP make_pair
#define X first
#define Y second
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
using namespace std;

int main(){

	int v[2001] = {};
	rep(i, 1001){
		rep(j, 1001){
			v[i+j]++;
		}
	}

	int vv[4001] = {};
	rep(i, 2001){
		rep(j, 2001){
			vv[i+j] += v[i]*v[j];
		}
	}

	int n;
	while(cin >> n){
		cout << vv[n] << endl;
	}

	return 0;
}