#include <bits/stdc++.h>
using namespace std;
int dp[1 << 16][280];
long long r[20], b[20];
char c[20];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> c[i] >> r[i] >> b[i];
  }
  memset(dp, 0x8f, sizeof dp);
  dp[0][0] = 0;
  int limit = 1 << n;
  for (int s = 0; s < limit; s++) {
    long long red = 0, blue = 0;
    for (int i = 0; i < n; i++) {
      if (s & (1 << i)) {
        if (c[i] == 'R')
          red++;
        else
          blue++;
      }
    }
    for (int j = 0; j <= 256; j++) {
      for (int i = 0; i < n; i++) {
        if (!(s & (1 << i))) {
          dp[s | (1 << i)][j + min(red, r[i])] =
              max((long long)dp[s | (1 << i)][j + min(red, r[i])],
                  dp[s][j] + min(blue, b[i]));
        }
      }
    }
  }
  long long sumRed = 0, sumBlue = 0;
  for (int i = 0; i < n; i++) {
    sumRed += r[i];
    sumBlue += b[i];
  }
  long long ans = 1LL << 62;
  for (int j = 0; j <= 256; j++) {
    long long need = max(sumBlue - dp[limit - 1][j], sumRed - j) + n;
    ans = min(ans, need);
  }
  cout << ans << '\n';
  return 0;
}
