#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define ll long long
#define all(x) x.begin() , x.end()

const int N = 3e5 + 99 ;

int seg[4*N] , a[N] , n , q;
void build(int idx = 1 , int l = 0 , int r = n - 1){
    int lf = (idx << 1) , mid = (l + r) >> 1 , ri = lf + 1 ;
    if ( l == r ) seg[idx] = a[l];
    else{
        build( lf , l , mid );
        build( ri , mid + 1 , r);
        seg[idx] = seg[lf] ^ seg[ri];
    }
}
void update( int pos , int val , int idx = 1 , int l = 0 , int r = n - 1 ){
    int lf = (idx << 1) , mid = (l + r) >> 1 , ri = lf + 1 ;
    if ( l == r ){
        seg[idx] = val;
    }
    else{
        if ( pos <= mid ){
            update( pos , val , lf , l , mid );
        }
        else{
            update( pos , val , ri , mid + 1 , r);
        }
        seg[idx] = seg[lf] ^ seg[ri];
    }
}
int ask( int s , int e , int idx = 1 , int l = 0 , int r = n - 1 ){
    int lf = (idx << 1) , mid = (l + r) >> 1 , ri = lf + 1 ;
    if      ( s  > r || e  < l ) return 0;
    else if ( l >= s && r <= e ) return seg[idx];
    else{
        return ask(s,e,lf,l,mid) ^ ask(s,e,ri,mid+1,r);
    }
}

int main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifdef CLion
    freopen("input.txt" , "r" , stdin);
//    freopen("output.txt", "w" , stdout);
#endif
    
    cin >> n >> q;
    for ( int i = 0; i < n; ++i )
        cin >> a[i];
    build();

    while ( q-- ){
        int t , x , y;
        cin >> t >> x >> y;
        if ( t == 1 ){
            update(x - 1 , ask(x-1,x-1) ^ y);
        }
        else{
            cout << ask(x - 1 , y - 1) << "\n";
        }
    }
    return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define R register
#define LL long long

inline int read() {
	int x = 0, f = 1; char a = getchar();
	for(; a > '9' || a < '0'; a = getchar()) if(a == '-') f = -1;
	for(; a <= '9' && a >= '0'; a = getchar()) x = x * 10 + a - '0';
	return x * f;
}

const int N = 20;

int n, m;
int ok[N][N];
int dp[1 << 18];
int stk[N], top;

inline int check(int S) {
	top = 0;
	for(R int i = 1; i <= n; i ++)
		if(S & (1 << (i - 1))) stk[++ top] = i;
	for(R int i = 1; i <= top; i ++)
		for(R int j = i + 1; j <= top; j ++)
			if(ok[stk[i]][stk[j]] == 0) return 0;
	return 1;
}

#define min(x,y) (x) < (y) ? (x) : (y)

signed main() {
	#ifdef IN
	//freopen(".in", "r", stdin);
	//freopen(".out", "w", stdout);
	#endif
	n = read(); m = read();
	for(R int i = 1; i <= m; i ++) {
		int x = read(), y = read();
		ok[x][y] = ok[y][x] = 1;
	}
	memset(dp, 0x3f, sizeof(dp));
	dp[0] = 0;
	int tot = 0;
	for(R int S = 1; S < (1 << n); S ++) {
		if(check(S)) { dp[S] = 1; continue; }
		if((S & -S) == S) { dp[S] = 1; continue; }
		for(R int T = S & (S - 1); T; T = (T - 1) & S) 
			dp[S] = min(dp[S], dp[T] + dp[S ^ T]); 
	}
	cout << dp[(1 << n) - 1] << endl;
	return 0;	
}