#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll>PII; const int N = 2e5 + 10; const int MOD = 998244353; const int INF = 0X3F3F3F3F; const int dx[] = {-1, 1, 0, 0, -1, -1, +1, +1}; const int dy[] = {0, 0, -1, 1, -1, +1, -1, +1}; const int M = 1e6 + 10; int n, q; int a[N]; int main() { cin >> n >> q; for(int i = 1; i <= n; i ++) cin >> a[i]; while(q --){ int o, i, x; cin >> o >> i >> x; if(o == 1) a[i] = x; else { int cnt = 0; for(int j = 1; j <= i; j ++) { if(a[j] == x) cnt ++; } cout << cnt << endl; } } return 0; }