#include<bits/stdc++.h>
using namespace std;
map<string,int> a;
int n,ans;
int main(){
cin>>n;
while(n--){
int opt;
string name;
int s;
cin>>opt;
if(opt==1){
cin>>name>>s;
if(a[name]==0) ans++;
a[name]=s;
cout<<"OK\n";
}
if(opt==2){
cin>>name;
if(a[name]==0) cout<<"Not found\n";
else cout<<a[name]<<"\n";
}
if(opt==3){
cin>>name;
if(a[name]==0) cout<<"Not found\n";
else{
cout<<"Deleted successfully\n";
a[name]=0;
ans--;
}
}
if(opt==4) cout<<ans;
}
return 0;
}