#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int cnt = 0;
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++) {
      for (int k = j; k < j + i && k <= n; k++) {
        if ((i ^ j ^ k) == 0) cnt++;
      }
    }
  printf("%d", cnt);
}
