#include <bits/stdc++.h>
using namespace std;
const int maxn = 17, inf = 1e9 + 10;
int n, r[maxn], b[maxn], tot1, tot2;
int cntr[(1 << maxn)], cntb[(1 << maxn)];
int dp[(1 << maxn)][maxn * maxn];
char color[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> color[i] >> r[i] >> b[i];
    tot1 += r[i], tot2 += b[i];
  }
  for (int mask = 0; mask < (1 << n); ++mask) {
    for (int i = 0; i < n; ++i) {
      if (mask & (1 << i)) {
        cntr[mask] += (color[i] == 'R');
        cntb[mask] += (color[i] == 'B');
      }
    }
    for (int ga = 0; ga <= n * n; ++ga) {
      dp[mask][ga] = -inf;
    }
  }
  dp[0][0] = 0;
  for (int mask = 1; mask < (1 << n); ++mask) {
    for (int i = 0; i < n; ++i) {
      if (!(mask & (1 << i))) {
        continue;
      }
      for (int ga = min(r[i], cntr[mask ^ (1 << i)]); ga <= n * n; ++ga) {
        dp[mask][ga] =
            max(dp[mask][ga],
                dp[mask ^ (1 << i)][ga - min(r[i], cntr[mask ^ (1 << i)])] +
                    min(b[i], cntb[mask ^ (1 << i)]));
      }
    }
  }
  int ans = inf;
  for (int ga = 0; ga <= n * n; ++ga) {
    ans = min(ans, max(tot2 - dp[(1 << n) - 1][ga], tot1 - ga));
  }
  cout << ans + n << endl;
}
