#pragma GCC optimize("O3") #include "bits/stdc++.h" using namespace std; #define all(x) x.begin(),x.end() template ostream& operator<<(ostream &os, const pair &p) { return os << p.first << " " << p.second; } template::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { string sep; for (const T &x : v) os << sep << x, sep = " "; return os; } #ifdef LOCAL #include "debug.h" #else #define debug(...) 42 #define ASSERT(...) 42 #endif typedef long long ll; typedef vector vi; typedef vector vvi; typedef pair pi; const int oo = 1e9; const int N = 1<<30; const int B = 64; const int K = N/B; typedef unsigned long long ull; ull x[K]; int ans[1<<16]; int calc4(ull x) { return ans[x]; } int calc2(ull x) { ull y = x>>(B/4); return calc4(y) + calc4((x|y) &( (1ULL<<(B/4)) - 1) ); } int calc(ull x) { ull y = x>>(B/2); return calc2((x|y)&( (1ULL<<(B/2)) - 1))+calc2(y); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; for(int i=0;i<1<<16;++i) { bool b[16] = {}; for(int j=0;j<16;++j) b[j] = i>>j&1; for(int j=0;j<4;++j) { for(int x=0;x<16;++x) if(!(1<> a; x[a/B]|=1ULL<<(a%B); } for(int j=0;(1<