AC+WA+WA+WA+TLE+TLE+TLE+TLE+TLE_TLE
#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m;
int a[100005];
signed main(){
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<=m;i++){
char c;
int x;
cin>>c>>x;
if(c=='C'){
for(int j=1;j<=n;j++){
a[j]+=x;
if(a[j]>65535) a[j]%=65535;
}
}else{
int sum=0;
for(int j=1;j<=n;j++){
if((a[j])&(pow(2,x))>=1) sum++;
}
cout<<sum<<endl;
}
}
return 0;
}