#include <bits/stdc++.h>
using namespace std;
const bool test = false;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
unsigned long long mod = (int)1e9 + 7;
const int MAX = (int)2e5 + 5;
void solve() {
  long long n;
  cin >> n;
  set<pair<int, int>> s;
  for (int a = 0; a < n + 1; ++a)
    for (int b = 0; b < n + 1 - a; ++b) {
      int u = a ^ b;
      int v = a + b;
      cout << "u = " << u << " ";
      cout << "v = " << v << "  ";
      cout << "a = " << a << " ";
      cout << "b = " << b << endl;
      s.insert({u, v});
    }
  cout << s.size() << endl;
}
signed main() {
  cout << fixed << setprecision(20);
  for (int i = 0; i < 1; ++i) solve();
  return 0;
}
