#include <bits/stdc++.h>
using std::cin;
using std::cout;
const int maxn = 16;
const int mod = 998244353;
int n, a[maxn], b[maxn];
int sr, sb;
int f[1 << maxn][maxn * maxn];
inline void up(int& x, int y) {
  if (x < y) {
    x = y;
  }
}
inline void down(int& x, int y) {
  if (x > y) {
    x = y;
  }
}
int main() {
  std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  int sumr = 0, sumb = 0;
  for (int i = 0; i < n; ++i) {
    char c;
    cin >> c;
    (c == 'R' ? sr : sb) |= 1 << i;
    cin >> a[i] >> b[i];
    sumr += a[i];
    sumb += b[i];
  }
  const int N = n * (n - 1) >> 1;
  for (int i = 0; i < 1 << n; ++i)
    for (int j = 0; j <= N; ++j) {
      f[i][j] = -1e9;
    }
  f[0][0] = 0;
  for (int i = 0; i < 1 << n; ++i) {
    int cr = __builtin_popcount(i & sr), cb = __builtin_popcount(i & sb);
    for (int j = (0),
             jend = (__builtin_popcount(i) * (__builtin_popcount(i) - 1) >> 1);
         j <= jend; ++j) {
      for (int k = (0), kend = (n - 1); k <= kend; ++k)
        if ((i >> k & 1) == 0) {
          const int R = std::min(cr, a[k]), B = std::min(cb, b[k]);
          up(f[i | 1 << k][j + R], f[i][j] + B);
        }
    }
  }
  int ans = 1e9;
  for (int j = (0), jend = (N); j <= jend; ++j) {
    down(ans, std::max(sumr - j, sumb - f[(1 << n) - 1][j]));
  }
  cout << ans + n << '\n';
}
