#include <bits/stdc++.h>
using namespace std;
int ans = 1000000005, rans = 0, bans = 0;
int numr[20], numb[20], color[20];
int dp[70005][160];
bool life[70005][160];
int nowr, nowb, tempr, tempb;
char s[6];
int nex[20];
void ok(int x) {
  int now;
  nowr = nowb = now = 0;
  while (x) {
    if (x % 2) {
      if (color[now])
        nowb++;
      else
        nowr++;
    }
    x /= 2;
    now++;
  }
}
int main() {
  int n;
  cin >> n;
  int maxx = 1 << n, maxxx = n * (1 + n) / 2;
  nex[0] = 1;
  life[0][0] = 1;
  for (int i = 1; i < n; i++) nex[i] = nex[i - 1] * 2;
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    if (s[0] == 'R')
      color[i] = 0;
    else
      color[i] = 1;
    scanf("%d%d", numr + i, numb + i);
    rans += numr[i];
    bans += numb[i];
  }
  for (int i = 0; i < maxx; i++) {
    ok(i);
    for (int j = 0; j < n; j++) {
      if ((nex[j] & i) == 0) {
        tempr = min(nowr, numr[j]);
        tempb = min(nowb, numb[j]);
        for (int k = 0; k <= maxxx; k++)
          if (life[i][k]) {
            dp[i + nex[j]][k + tempr] =
                max(dp[i + nex[j]][k + tempr], dp[i][k] + tempb);
            life[i + nex[j]][k + tempr] = 1;
          }
      }
    }
  }
  for (int i = 0; i < maxxx; i++)
    if (life[maxx - 1][i]) {
      ans = min(ans, max(rans - i, bans - dp[maxx - 1][i]));
    }
  cout << ans + n << endl;
  return 0;
}
