1 #include <bits/stdc++.h>
2 typedef long long ll;
3 using namespace std;
4 #define _for(i,a,b) for(int i = (a);i < b;i ++)
5 #define _rep(i,a,b) for(int i = (a);i > b;i --)
6 #define INF 0x3f3f3f3f
7 #define MOD 1000000007
8 #define pb push_back
9 #define maxn 100003
10 inline ll read()
11 {
12 ll ans = 0;
13 char ch = getchar(), last = ' ';
14 while(!isdigit(ch)) last = ch, ch = getchar();
15 while(isdigit(ch)) ans = (ans << 1) + (ans << 3) + ch - '0', ch = getchar();
16 if(last == '-') ans = -ans;
17 return ans;
18 }
19 inline void write(ll x)
20 {
21 if(x < 0) x = -x, putchar('-');
22 if(x >= 10) write(x / 10);
23 putchar(x % 10 + '0');
24 }
25 struct P
26 {
27 int l;
28 int r;
29 bool operator <(const P &x) const
30 {
31 return r<x.l;
32 }
33 };
34 int N;
35 set<P> s;
36 int main()
37 {
38 N = read();
39 while(N--)
40 {
41 string op;
42 cin >> op;
43 if(op=="A")
44 {
45 P tp;
46 tp.l = read();
47 tp.r = read();
48 int ans = 0;
49 auto it = s.find(tp);
50 while(it != s.end())
51 {
52 ans ++;
53 s.erase(it);
54 it = s.find(tp);
55 }
56 s.insert(tp);
57 write(ans);
58 printf("\n");
59 }
60 else
61 {
62 write(s.size());
63 printf("\n");
64 }
65 }
66 return 0;
67 }