#include <iostream>
#include <algorithm>
#define MAX 1000
using namespace std;

int main(){
  
  int n, pt[(MAX+1) * MAX];
  while(cin >> n){
    for(int i = 0; i <= MAX; i++){
      for(int j = 0; j <= MAX; j++) pt[i * MAX + j] = i + j;
    }
    sort(pt, pt + (MAX+1) * MAX);
    
    int ret = 0;
    for(int i = 0; i <= MAX; i++){
      for(int j = 0; j <= MAX; j++){
	int cd = i + j;
	ret += upper_bound(pt, pt + (MAX+1) * MAX, n - cd) - lower_bound(pt, pt + (MAX+1) * MAX, n - cd);
      }
    }
    cout << ret << endl;
  }

}