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

int search_around(int k[], int i, int n) {
  int ans = 1;
  for(int j = i-1; 0 <= j && j <= 1001*1001 && k[j] == n; j--) ans++;
  for(int j = i+1; 0 <= j && j <= 1001*1001 && k[j] == n; j++) ans++;
  return ans;
}

int search(int k[], int n) {
  int l = 0, r = 1001*1001;
  while(r-l >= 1) {
    int i = (l+r) / 2;
    if(k[i] == n) return search_around(k, i, n);
    else if(k[i] < n) l = i+1;
    else r = i;
  }
  return 0;
}

int main() {
  int k[1001*1001];;
  for(int i = 0; i <= 1000; i++) {
    for(int j = 0; j <= 1000; j++) {
      k[1001*i + j] = i+j;
    }
  }
  sort(k, k+1001*1001);

  int n;
  while(cin >> n) {
    int ans = 0;
    for(int i = 0; i <= 1000; i++) {
      for(int j = 0; j <= 1000; j++) {
	ans += search(k,n-i-j);
      } 
    }
    cout << ans << endl;
  }
}