#include <bits/stdc++.h>
using namespace std;
inline int min(int _a, int _b) { return _a < _b ? _a : _b; }
inline int max(int _a, int _b) { return _a > _b ? _a : _b; }
template <class T>
inline void rd(T &_a) {
  int _f = 0, _ch = getchar();
  _a = 0;
  while (_ch < '0' || _ch > '9') {
    if (_ch == '-') _f = 1;
    _ch = getchar();
  }
  while (_ch >= '0' && _ch <= '9') {
    _a = (_a << 1) + (_a << 3) + _ch - '0';
    _ch = getchar();
  }
  if (_f) _a = -_a;
}
const int inf = 0x3f3f3f3f;
const double eps = 1e-8;
const int S = 120;
const int N = 17;
int dp[1 << N][S + 5], r[N], b[N];
char c[N][10];
int main() {
  memset(dp, -1, sizeof dp);
  int n, ar = 0, ab = 0, ans = inf;
  rd(n);
  for (int i = 0; i < n; i++) {
    scanf("%s", c[i]);
    rd(r[i]);
    rd(b[i]);
    ar += r[i], ab += b[i];
  }
  int t = 1 << n;
  dp[0][0] = 0;
  for (int i = 0; i < t; i++) {
    int rr = 0, rb = 0;
    for (int j = 0; j < n; j++)
      if (i & (1 << j)) c[j][0] == 'R' ? rr++ : rb++;
    for (int j = 0; j <= S; j++)
      if (dp[i][j] != -1)
        for (int k = 0; k < n; k++)
          if (!(i & (1 << k))) {
            int tr = min(rr, r[k]), tb = min(rb, b[k]);
            dp[i | (1 << k)][j + tr] =
                max(dp[i | (1 << k)][j + tr], dp[i][j] + tb);
          }
  }
  for (int i = 0; i <= S; i++)
    if (dp[t - 1][i] != -1) ans = min(ans, max(ar - i, ab - dp[t - 1][i]));
  printf("%d", ans + n);
  return 0;
}
