#include <bits/stdc++.h>
using namespace std;
struct debug_t {
  template <typename T>
  debug_t& operator<<(const T& value) {
    return *this;
  }
  debug_t& write(const char data[], streamsize n) { return *this; }
} debug;
struct Card {
  char c;
  int red, blue;
};
int n;
Card cards[16];
unordered_map<int, int> dp[1 << 16];
int dyn(int mask, int red, int blue, int redCards, int blueCards) {
  assert(!red || !blue);
  if (!mask) return 0;
  const auto delta = red - blue;
  auto it = dp[mask].find(delta);
  if (it != dp[mask].end()) {
    return it->second;
  }
  const auto initial = mask;
  int result = INT_MAX;
  for (int i = 0; i < n; i++) {
    if (mask & 0x1) {
      int redCost = max(cards[i].red - redCards, 0);
      int blueCost = max(cards[i].blue - blueCards, 0);
      int await = max(redCost - red, max(blueCost - blue, 0));
      int t;
      if (cards[i].c == 'R')
        t = dyn(initial ^ 1 << i, red + await - redCost,
                blue + await - blueCost, redCards + 1, blueCards);
      else
        t = dyn(initial ^ 1 << i, red + await - redCost,
                blue + await - blueCost, redCards, blueCards + 1);
      result = min(result, t + await);
    }
    mask >>= 1;
  }
  dp[initial].emplace(delta, result);
  return result;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> cards[i].c >> cards[i].red >> cards[i].blue;
  cout << dyn((1 << n) - 1, 0, 0, 0, 0) + n << endl;
  _Exit(0);
}
