#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, pt[(1000 + 1) * 1000];
  while (cin >> n) {
    for (int i = 0; i <= 1000; i++) {
      for (int j = 0; j <= 1000; j++) pt[i * 1000 + j] = i + j;
    }
    sort(pt, pt + (1000 + 1) * 1000);
    int ret = 0;
    for (int i = 0; i <= 1000; i++) {
      for (int j = 0; j <= 1000; j++) {
        int cd = i + j;
        ret += upper_bound(pt, pt + (1000 + 1) * 1000, n - cd) -
               lower_bound(pt, pt + (1000 + 1) * 1000, n - cd);
      }
    }
    cout << ret << endl;
  }
}
