#include <bits/stdc++.h>
using namespace std;
const int M = 20;
int read() {
  int x = 0, f = 1;
  char c;
  while ((c = getchar()) < '0' || c > '9') {
    if (c == '-') f = -1;
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
int n, ans, sa, sb, a[M], b[M], na[1 << 16], nb[1 << 16], dp[1 << 16][122];
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    char c;
    cin >> c;
    a[i] = read();
    b[i] = read();
    sa += a[i];
    sb += b[i];
    for (int j = 1; j < (1 << n); j++)
      if (j & (1 << i - 1)) {
        if (c == 'R')
          na[j]++;
        else
          nb[j]++;
      }
  }
  memset(dp, -0x3f, sizeof dp);
  dp[0][0] = 0;
  for (int s = 0; s < (1 << n); s++) {
    for (int j = 0; j <= 120; j++) {
      if (dp[s][j] == -0x3f3f3f3f) continue;
      for (int i = 1; i <= n; i++) {
        if (s >> (i - 1) & 1) continue;
        int t = s | (1 << i - 1);
        int pa = min(na[s], a[i]), pb = min(nb[s], b[i]);
        dp[t][j + pa] = max(dp[t][j + pa], dp[s][j] + pb);
      }
    }
  }
  ans = 0x3f3f3f3f;
  for (int i = 0; i <= 120; i++)
    ans = min(ans, max(sa - i, sb - dp[(1 << n) - 1][i]));
  printf("%d\n", ans + n);
}
