#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define str string
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int) a.size()
#define fi first
#define se second
// using namespace __gnu_pbds;
// #define o_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
using namespace std;

// mt19937 rng(474);

// int getnum(int l,int r){
//     uniform_int_distribution<int> dist(l,r);
//     return dist(rng);
// }

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n,q;
    cin >> n >> q;
    vector<int> a(n);
    for(int &i : a) cin >>i;
    while(q--) {
        int type,l,r;
        cin >> type >> l >> r;
        if(r-l == 0){
            if(l%2) cout <<0 << '\n';
            else cout << 1 << '\n';
        }else{
            cout << 1 << '\n';
        }
        // cout << r-l+1 << '\n';
    }
}