problem link
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// my idea
//i can make groups of people which have at least on e common point and
//get such group with maximum members and i can say the remaining are lying
int n; cin >> n;
vector<pair<char,ll>>v;
for(int i=0;i<n;++i){
char c; cin >> c;
int k; cin >> k;
v.push_back({c,k});
}
ll max_group=0;
for(int i=0;i<n;++i){
char c=v[i].first;
ll val=v[i].second;
ll group=0;
for(int j=0;j<n;++j){
if(c == 'G'){
if(v[j].first == 'G')
group++;
else if(v[j].second >= val)
group++;
}else{
if(v[j].first == 'L')
group++;
else if(v[j].second <= val)
group++;
}
}
max_group=max(max_group,group);
}
cout<<n-max_group<<"\n";
return 0;
}