#include <bits/stdc++.h>
using namespace std;
template <typename TH>
void _dbg(const char* sdbg, TH h) {
  cerr << sdbg << "=" << h << "\n";
}
template <typename TH, typename... TA>
void _dbg(const char* sdbg, TH h, TA... t) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << "=" << h << ",";
  _dbg(sdbg + 1, t...);
}
template <class C>
void mini(C& a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C& a4, C b4) {
  a4 = max(a4, b4);
}
template <class T1, class T2>
ostream& operator<<(ostream& out, pair<T1, T2> pair) {
  return out << "(" << pair.first << ", " << pair.second << ")";
}
template <class A, class B, class C>
struct Triple {
  A first;
  B second;
  C third;
  bool operator<(const Triple& t) const {
    if (first != t.first) return first < t.first;
    if (second != t.second) return second < t.second;
    return third < t.third;
  }
};
template <class T>
void ResizeVec(T&, vector<long long>) {}
template <class T>
void ResizeVec(vector<T>& vec, vector<long long> sz) {
  vec.resize(sz[0]);
  sz.erase(sz.begin());
  if (sz.empty()) {
    return;
  }
  for (T& v : vec) {
    ResizeVec(v, sz);
  }
}
template <class A, class B, class C>
ostream& operator<<(ostream& out, Triple<A, B, C> t) {
  return out << "(" << t.first << ", " << t.second << ", " << t.third << ")";
}
template <class T>
ostream& operator<<(ostream& out, vector<T> vec) {
  out << "(";
  for (auto& v : vec) out << v << ", ";
  return out << ")";
}
struct Info {
  long long turns, red, blue;
  bool operator<(const Info& oth) const {
    if (turns != oth.turns) return turns < oth.turns;
    if (red != oth.red) return red < oth.red;
    return blue < oth.blue;
  }
  friend ostream& operator<<(ostream& out, Info i) {
    return out << "(" << i.turns << ", " << i.red << ", " << i.blue << ")";
  }
};
bool IsDominated(Info i1, Info i2) {
  i1.red += i2.turns - i1.turns;
  i1.blue += i2.turns - i1.turns;
  return i1.red <= i2.red && i1.blue <= i2.blue;
}
const long long N = 16;
vector<Info> res[1 << N];
long long has_red[1 << N];
long long has_blue[1 << N];
long long is_red[N];
long long r[N], b[N];
int32_t main() {
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  if (0) cout << fixed << setprecision(10);
  cin.tie(0);
  long long n;
  cin >> n;
  for (long long i = 0; i < (n); ++i) {
    char c;
    cin >> c;
    if (c == 'R') {
      is_red[i] = 1;
    }
    cin >> r[i] >> b[i];
  }
  res[0].push_back({0, 0, 0});
  for (long long mask = 0; mask < (1 << n); ++mask) {
    if (mask == 0) {
      continue;
    }
    for (long long last = 0; last < (n); ++last) {
      if (!(mask & (1 << last))) {
        continue;
      }
      long long prv_mask = mask - (1 << last);
      has_red[mask] = has_red[prv_mask] + (is_red[last]);
      has_blue[mask] = __builtin_popcount(mask) - has_red[mask];
      for (auto& prv_res : res[prv_mask]) {
        long long cost_r = max(0ll, r[last] - has_red[prv_mask]);
        long long cost_b = max(0ll, b[last] - has_blue[prv_mask]);
        long long need_turns =
            max(max(0ll, cost_r - prv_res.red), cost_b - prv_res.blue);
        auto new_res = prv_res;
        new_res.turns += need_turns;
        new_res.red += need_turns;
        new_res.blue += need_turns;
        new_res.red -= cost_r;
        new_res.blue -= cost_b;
        (mask, last, new_res, need_turns);
        assert(new_res.red == 0 || new_res.blue == 0);
        bool fail = false;
        for (auto& R : res[mask]) {
          if (IsDominated(new_res, R)) {
            fail = true;
            break;
          }
        }
        if (!fail) {
          vector<Info> new_heh;
          for (auto& R : res[mask]) {
            if (!IsDominated(R, new_res)) {
              new_heh.push_back(R);
            }
          }
          new_heh.push_back(new_res);
          res[mask] = new_heh;
        }
      }
    }
    (mask, res[mask]);
  }
  long long best = 1e9;
  for (auto& H : res[(1 << n) - 1]) {
    mini(best, H.turns);
  }
  cout << best + n << endl;
  return 0;
}
