#include <bits/stdc++.h>
using namespace std;
const int P = 1e9 + 7, INF = 0x3f3f3f3f;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(long long a, long long n) {
  long long r = 1 % P;
  for (a %= P; n; a = a * a % P, n >>= 1)
    if (n & 1) r = r * a % P;
  return r;
}
long long inv(long long first) {
  return first <= 1 ? 1 : inv(P % first) * (P - P / first) % P;
}
const int N = 20;
int n;
char c[N];
int first[N], second[N];
int dp[1 << 16][150];
void chkmax(int &a, int b) { a = max(a, b); }
int main() {
  scanf("%d", &n);
  for (int i = 0; i <= n - 1; ++i)
    scanf(" %c%d%d", c + i, first + i, second + i);
  memset(dp, 0xbc, sizeof dp);
  dp[0][0] = 0;
  int mx = (1 << n) - 1;
  for (int i = 0; i <= mx - 1; ++i) {
    int A = 0, B = 0;
    for (int k = 0; k <= n - 1; ++k)
      if (i >> k & 1) {
        if (c[k] == 'R')
          ++A;
        else
          ++B;
      }
    for (int k = 0; k <= n - 1; ++k)
      if (!(i >> k & 1)) {
        for (int j = 0; j <= 120; ++j)
          if (dp[i][j] != 0xbcbcbcbc) {
            chkmax(dp[i ^ 1 << k][j + min(first[k], A)],
                   dp[i][j] + min(second[k], B));
          }
      }
  }
  int ans = INF, X = 0, Y = 0;
  for (int i = 0; i <= n - 1; ++i) X += first[i], Y += second[i];
  for (int i = 0; i <= 120; ++i) ans = min(ans, max(X - i, Y - dp[mx][i]));
  printf("%d\n", ans + n);
}
