#include<bits/stdc++.h>
using namespace std;
map<string,int> m;
int n;
int k,j;
int ans;
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>k;
string temp1;
int score;
if(k==1){
cin>>temp1>>score;
if(!m[temp1]){
cout<<"OK"<<endl;
ans++;
}
m[temp1]=score;
}
else if(k==2){
cin>>temp1;
if(!m[temp1]){
cout<<"Not found"<<endl;
}
else cout<<m[temp1]<<endl;
}
else if(k==3){
cin>>temp1;
if(!m[temp1]){
cout<<"Not found";
}
else {
m[temp1]=0;
ans--;
cout<<"Deleted successfully"<<endl;
}
}
else cout<<ans<<endl;
}
return 0;
}