#include <bits/stdc++.h>
using namespace std;
int n,x,y,z,ans,zs;
map<int,int> mp1;
map<pair<int,int>,int> mp2;
int main(){
scanf("%d",&n);
while(n--){
scanf("%d%d%d",&x,&y,&z);
if(x==1){
++zs;
++mp1[y];
++mp2[make_pair(y,z)];
}else if(x==3){
zs=mp1[y]-mp2[make_pair(y,z)];
mp1.clear();mp2.clear();
mp1[y]=zs;
}else if(x==2) printf("%d\n",zs-mp1[y]);
}
return 0;
}
QAQ感觉都对了,为什么嘎掉了QAQ