#include <bits/stdc++.h>
using namespace std;
struct Plan
{
int l, r;
bool operator < (const Plan & p) const
{
return r < p.l;
}
};
int T;
multiset<Plan> s;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> T;
while (T--){
char c;
cin >> c;
if(c == 'A'){
int l,r,cnt = 0;
cin >> l >> r;
Plan tmp = Plan{l,r};
cout << s.count(tmp) << "\n";
while(s.count(tmp)) s.erase(tmp);
s.insert(tmp);
}
else cout << s.size() << "\n";
}
return 0;
}