#include using namespace std; int dfs(long long L, long long R, long long l, long long r){ if (r <= L || R <= l){ return 0; } else if (L <= l && r <= R){ return 1; } else { long long m = (l + r) / 2; return dfs(L, R, l, m) + dfs(L, R, m, r); } } int main(){ int N, Q; cin >> N >> Q; for (int i = 0; i < Q; i++){ long long S, T; cin >> S >> T; cout << dfs(S, T, 0, (long long) 1 << N) << endl; } }