#include <bits/stdc++.h>
using namespace std;
const int N = 200020;
long long int n;
long long int dp[77777][300];
long long int cR[N];
long long int cB[N];
long long int r[N];
long long int b[N];
bool type[N];
int main() {
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    char c;
    cin >> c;
    type[i] = (c == 'R');
    cin >> r[i] >> b[i];
  }
  for (long long int mask = 0; mask < (1 << n); mask++) {
    cR[mask] = 0;
    cB[mask] = 0;
    for (long long int i = 0; i < n; i++) {
      if (mask & (1 << i)) {
        cR[mask] += (type[i] == 1);
        cB[mask] += (type[i] == 0);
      }
    }
  }
  for (long long int i = 0; i < (1 << n); i++) {
    for (long long int j = 0; j < 300; j++) dp[i][j] = -1;
  }
  dp[0][0] = 0;
  for (long long int mask = 0; mask < (1 << n); mask++) {
    for (long long int j = 0; j < 300; j++) {
      long long int val = dp[mask][j];
      if (val == -1) continue;
      for (long long int i = 0; i < n; i++) {
        if (mask & (1 << i)) continue;
        long long int newr = j + min(r[i], cR[mask]);
        long long int newb = val + min(b[i], cB[mask]);
        dp[mask | (1 << i)][newr] = max(dp[mask | (1 << i)][newr], newb);
      }
    }
  }
  long long int allR = 0;
  long long int allB = 0;
  for (long long int i = 0; i < n; i++) {
    allR += r[i];
    allB += b[i];
  }
  long long int ans = max(allR, allB);
  for (long long int i = 0; i < 300; i++) {
    long long int val = dp[(1 << n) - 1][i];
    if (val == -1) continue;
    ans = min(ans, max(allR - i, allB - val));
  }
  cout << ans + n << endl;
  return 0;
}
