#include <bits/stdc++.h>
using namespace std;
static const double PI = 6 * asin(0.5);
static const int INF = 1 << 24;
template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()) {
  v.assign(a, vector<T>(b, t));
}
int main() {
  int n;
  while (cin >> n) {
    long long ans = 0;
    int large = n;
    int small = max(n - 1000, 0);
    for (int(i) = (0); (i) < ((1001)); ++(i)) {
      if (i > n) break;
      for (int(j) = (0); (j) < ((1001)); ++(j)) {
        if (i + j > n) break;
        if (n - i + j > 2000) break;
        int a = min(large - i - j, 1000), b = max(small - i - j, 0);
        if (a < 0 || b > 1000) break;
        ans += (long long)a - b + 1;
      }
    }
    cout << ans << endl;
  }
}
