#include <bits/stdc++.h>
using namespace std;
int f[4001];
int main() {
  fill(f, f + 4001, -1);
  int n;
  while (cin >> n) {
    if (f[n] != -1) {
      cout << f[n] << endl;
      continue;
    }
    vector<int> v;
    for (int i = 0; i <= 1000; i++) {
      if (n < i) break;
      for (int j = 0; j <= 1000; j++) {
        if (n < i + j) break;
        if (n <= i + j + 2000) v.push_back(i + j);
      }
    }
    sort(v.begin(), v.end());
    int ans = 0;
    for (int i = 0; i < v.size(); i++) {
      int k = n - v[i];
      int res = upper_bound(v.begin(), v.end(), k) -
                lower_bound(v.begin(), v.end(), k);
      ans += res;
    }
    f[n] = f[4000 - n] = ans;
    cout << f[n] << endl;
  }
}
