#include <bits/stdc++.h>
using namespace std;
const int N = 1048576;
int n, r[20], b[20];
char c[20];
map<pair<int, int>, int> dp[N];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    cin >> c[i] >> r[i] >> b[i];
  }
  dp[0][make_pair(0, 0)] = 0;
  for (int i = 0; i < (1 << n); i++) {
    int redCards = 0, blueCards = 0;
    for (int j = 0; j < n; j++) {
      if (i & (1 << j)) {
        if (c[j] == 'R')
          redCards++;
        else
          blueCards++;
      }
    }
    for (int j = 0; j < n; j++) {
      if (i & (1 << j)) continue;
      for (auto it : dp[i]) {
        int redTokens = it.first.first;
        int blueTokens = it.first.second;
        int needsToAdd = max(max(r[j] - redTokens - redCards, 0),
                             max(b[j] - blueTokens - blueCards, 0));
        redTokens = redTokens + needsToAdd - max(r[j] - redCards, 0);
        blueTokens = blueTokens + needsToAdd - max(b[j] - blueCards, 0);
        int to = i | (1 << j);
        if (dp[to].count(make_pair(redTokens, blueTokens)) == 0)
          dp[to][make_pair(redTokens, blueTokens)] = it.second + needsToAdd;
        else
          dp[to][make_pair(redTokens, blueTokens)] = min(
              dp[to][make_pair(redTokens, blueTokens)], it.second + needsToAdd);
      }
    }
  }
  int res = 2e9;
  for (auto it : dp[(1 << n) - 1]) {
    res = min(res, it.second);
  }
  cout << res + n;
  return 0;
}
