#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#define all(n) n.begin(),n.end()
using namespace std;

int main()
{
  int n;
  map<int,int> tes;
  vector<int> vec;
  for(int i=0;i<=1000;i++)
    for(int j=0;j<=1000;j++)
      vec.push_back(i+j),tes[i+j]++;
  sort(all(vec));

  while(cin >> n)
    {
      unsigned long long sum = 0;
      for(int i=0;i<=1000 && i <= n;i++)
	for(int j=0;j<=1000 && j+i <= n;j++)
	  sum += upper_bound(all(vec),n-(i+j))-lower_bound(all(vec),n-(i+j));
	     
      cout << sum << endl;
    }
  return 0;
}