#include #define rep(i, a, b) for(int i = (a); i <= (b); i ++) using std::cin, std::cout, std::cerr; using ll = long long; int main() { std::ios::sync_with_stdio(false); int n; cin >> n; auto p = [](int n) { return __builtin_popcount(n); }; int ans = 0; rep(i, 0, n) rep(j, i, n) if(p(i) == p(j)) ans += (i & j); cout << ans << '\n'; }