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

#define int long long
#define mod 1000000007
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define fst first
#define snd second
#define ff first
#define st second
#define endl "\n"
#define len(x) x.size()

void I_LOVE_PEREKOPSKA() {
    int n, q;
    cin>>n>>q;
    vector<int> a(n);
    for (auto &x:a)
        cin>>x;
    while (q--) {
        int t;
        cin>>t;
        if (t==1) {
            int p;
            cin>>p;
            a[p-1] = -a[p-1];
        }
        if (t==2) {
            int l,r;
            cin>>l>>r;
            int k = r-l+1;
            cout<<k-(k%2!=0)<<endl;
        }
    }
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    int t = 1;
    // cin>>t;
    while (t--) {
        I_LOVE_PEREKOPSKA();
    }
}