#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")
const int maxn = 1e5 + 10, maxm = 1e6 + 10, lg = 17, mod = 1e9 + 7, inf = 1e18;
const int M = (1 << lg) + 20;
int n, r[lg], b[lg], ans, C[M][2], dp[M][lg * lg], sr, sb;
void maxi(int &x, int y) {
  if (x < y) x = y;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    char CC;
    cin >> CC >> r[i] >> b[i];
    sr += r[i], sb += b[i];
    for (int msk = 0; msk < (1 << n); msk++)
      if (msk >> i & 1) {
        if (CC == 'R')
          C[msk][0]++;
        else
          C[msk][1]++;
      }
  }
  memset(dp, -69, sizeof(dp));
  dp[0][0] = 0;
  for (int msk = 1; msk < (1 << n); msk++)
    for (int i = 0; i < n; i++)
      if (msk >> i & 1)
        for (int j = min(r[i], C[msk ^ (1 << i)][0]); j <= n * n; j++)
          maxi(dp[msk][j],
               dp[msk ^ (1 << i)][j - min(r[i], C[msk ^ (1 << i)][0])] +
                   min(b[i], C[msk ^ (1 << i)][1]));
  int nn = inf;
  for (int j = 0; j <= n * n; j++)
    nn = min(nn, max(sr - j, sb - dp[(1 << n) - 1][j]));
  cout << nn + n;
  return 0;
}
