import sys, os, io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
n = int(input())
ans = 0
for i in range(1, n + 1):
for j in range(i, n + 1):
k = i ^ j
if j <= k <= n and i + j > k:
ans += 1
print(ans)
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define int long long
int komi = 0;
int check( vector<int> arr){
if( arr[0] + arr[1] > arr[2])
return 1;
return 0;
}
void solve(){
int n; cin >> n;
set< vector<int> > st;
for( int i = 1; i <= n; ++i){
for( int j = i; j<=n; ++j){
if( (i^j) > n) continue;
vector<int> arr = {i,j, i^j};
sort( all(arr));
if( check(arr)){
st.insert(arr);
}
}
}
cout << st.size();
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int test = 1;
// cin >> test;
while( test--){
solve();
cout << "\n";
}
return 0;
}
253A - Boys and Girls | 1327E - Count The Blocks |
984A - Game | 12B - Correct Solution |
1355B - Young Explorers | 485A - Factory |
628A - Tennis Tournament | 1436B - Prime Square |
1707B - Difference Array | 1422C - Bargain |
1611F - ATM and Students | 660A - Co-prime Array |
1692F - 3SUM | 1470A - Strange Birthday Party |
190D - Non-Secret Cypher | 1721B - Deadly Laser |
1721C - Min-Max Array Transformation | 1721A - Image |
1180C - Valeriy and Deque | 557A - Ilya and Diplomas |
1037D - Valid BFS | 1144F - Graph Without Long Directed Paths |
1228A - Distinct Digits | 355B - Vasya and Public Transport |
1230A - Dawid and Bags of Candies | 1530A - Binary Decimal |
1472D - Even-Odd Game | 441C - Valera and Tubes |
1328E - Tree Queries | 265A - Colorful Stones (Simplified Edition) |