---
# System prepended metadata

title: Botas Trocadas

---

# Botas Trocadas

```cpp=
#include<bits/stdc++.h>
using namespace std;

int n;

int botas[65][2];
int ans = 0;

int main() {
  scanf("%d", &n);

  for (int i = 0; i < n; i++) {
    int x;
    char c;
    scanf("%d %c", &x, &c);
    botas[x][c - 'D']++;
  }

  for (int i = 30; i <= 60; i++) {
    ans += min(botas[i][0], botas[i][1]);
  }

  printf("%d\n", ans);

  return 0;
}
```