#include <bits/stdc++.h>
using namespace std;
const int MAX = 18;
const int MOD = 1000000007;
char c[MAX];
int r[MAX], b[MAX];
int dp[1 << 16][125];
int red[1 << 16], blue[1 << 16];
void precalc(int n) {
  for (int i = 0; i < (1 << n); i++) {
    for (int j = 0; j < n; j++) {
      if (!(i & (1 << j))) {
        continue;
      }
      if (c[j] == 'R') {
        red[i]++;
      } else {
        blue[i]++;
      }
    }
  }
}
int main() {
  for (int i = 0; i < 1 << 16; i++) {
    for (int j = 0; j < 125; j++) {
      dp[i][j] = -MOD;
    }
  }
  dp[0][0] = 0;
  long long rt = 0, bt = 0;
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf(" %c %d %d", &c[i], &r[i], &b[i]);
    rt += r[i];
    bt += b[i];
  }
  precalc(n);
  long long maxi = 1000000000000000000;
  for (int i = 0; i < (1 << n); i++) {
    for (int j = 0; j < 125; j++) {
      for (int k = 0; k < n; k++) {
        if (i & (1 << k)) {
          continue;
        }
        int res = i | (1 << k);
        int jnew = j + min(red[i], r[k]);
        dp[res][jnew] = max(dp[res][jnew], dp[i][j] + min(blue[i], b[k]));
      }
      maxi = min(maxi, max(rt - j, bt - dp[i][j]));
    }
  }
  printf("%lld\n", n + maxi);
}
