#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll DIM = 3e5+7;
const ll INF = 1e9+7;
int fact (int n) {
    int res=1;
    for(int i=1;i<=n;i++) res*=i;
    return res;
    }
ll n,q,a[DIM],p,l,r,res,cmd;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n>>q; 
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++) {
        cin>>cmd;
        if(cmd == 1) {
            cin>>p;
        }
        else {
            cin>>l>>r;
            if((r-l+1)%2==1) cout<<n-1<<endl;
            else cout<<n<<endl;
        }
    }
}

