#pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

#define el '\n'
#define ff first
#define ss second
#define pb push_back
#define point pair <ll, ll>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

const ll N = 1e2 + 10;
const ll inf = 1e18 + 10;

ll a[N], dp[N][N][N], suff[N];

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

    ll n, q;
    cin >> n >> q;

    for (ll i = 1; i <= n; i++)
        cin >> a[i];

    while (q--) {
        ll t, x, l, r;
        cin >> t;

        if (t == 1) {
            cin >> x;
            a[x] *= -1;
        } else {
            cin >> l >> r;

            for (ll i = 0; i <= n; i++)
                for (ll j = 0; j <= n; j++)
                    for (ll k = 0; k <= n; k++)
                        dp[i][j][k] = -inf;

            ll total = 0;
            for (ll i = l; i <= r; i++)
                if (a[i] == 1)
                    total++;

            dp[l - 1][0][total] = 0;
            for (ll i = l; i <= r; i++) {
                for (ll j = 0; j <= n; j++)
                    for (ll k = 0; k <= n; k++)
                        dp[i][j][k] = dp[i - 1][j][k];

                if (a[i] == 1) {
                    total--;
                    for (ll j = 1; j <= n; j++)
                        for (ll k = 0; k <= n; k++)
                            dp[i][j][k] = max(dp[i][j][k], dp[i - 1][j - 1][k] + 1);
                } else {
                    for (ll j = 0; j < n; j++)
                        for (ll k = 0; k <= n; k++)
                            if (min(k - 1, total - 1) >= 0)
                                dp[i][j][min(k - 1, total - 1)] = max(dp[i][j][min(k - 1, total - 1)], dp[i - 1][j + 1][k] + 1);
                }
            }

            ll ans = 0;
            for (ll i = 0; i <= n; i++)
                for (ll j = 0; j <= n; j++)
                    ans = max(ans, dp[r][i][j]);
            cout << ans << el;
        }
    }

    return 0;
}
