// Lakshay's code
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define ull unsigned long long
#define FOR(i,n) for(long long i = 0; i < (n); i++)
#define FOR1(i,n) for(long long i = 1; i <= (n); i++)
#define FOR2(i,n) for(long long i = 2; i <= (n); i++)
#define pb push_back
#define V vector<int>
#define VV vector<V>
#define VVV vector<VV>
#define el cout<<endl;
#define fi first
#define se second
#define noo cout<<"NO"<<endl;
#define yess cout<<"YES"<<endl;
#define se second
#define allv v.begin(),v.end()
// #define sort(v) sort(v.begin(),v.end())
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define w(T) ll T; cin>>T; while(T--)
using namespace std;
int n,k;
int32_t main() {
fast
cin>>n;
stack<int> st;
int cnt=0,r=0;
FOR(i,2*n){
string s; cin>>s;
if(s=="add"){
int x; cin>>x; st.push(x);
}
else{
r++;
// if(r==st.top()) st.pop();
if(st.empty()) continue;
else{
if(r==st.top()) st.pop();
else{
cnt++;
while (!st.empty()){
st.pop();
}
}
}
}
// cout<<cnt<<endl;
}
cout<<cnt<<endl;
return 0;
}
25B - Phone numbers | 1633C - Kill the Monster |
1611A - Make Even | 1030B - Vasya and Cornfield |
1631A - Min Max Swap | 1296B - Food Buying |
133A - HQ9+ | 1650D - Twist the Permutation |
1209A - Paint the Numbers | 1234A - Equalize Prices Again |
1613A - Long Comparison | 1624B - Make AP |
660B - Seating On Bus | 405A - Gravity Flip |
499B - Lecture | 709A - Juicer |
1358C - Celex Update | 1466B - Last minute enhancements |
450B - Jzzhu and Sequences | 1582C - Grandma Capa Knits a Scarf |
492A - Vanya and Cubes | 217A - Ice Skating |
270A - Fancy Fence | 181A - Series of Crimes |
1638A - Reverse | 1654C - Alice and the Cake |
369A - Valera and Plates | 1626A - Equidistant Letters |
977D - Divide by three multiply by two | 1654B - Prefix Removals |