#include <bits/stdc++.h>
using namespace std;
void incr(string &a, string &b) {
  if (((int)(a).size()) == 0) {
    a = b;
    return;
  }
  assert(((int)(a).size()) >= ((int)(b).size()));
  int ai = ((int)(a).size()) - 1, bi = ((int)(b).size()) - 1, c = 0;
  while (bi >= 0 || c != 0) {
    if (bi >= 0) c += b[bi] - '0';
    if (ai < 0) a = "0" + a, ++ai;
    c += a[ai] - '0';
    a[ai] = '0' + c % 10;
    c /= 10;
    --ai, --bi;
  }
}
string twice(string &s) {
  string ret = s;
  incr(ret, s);
  return ret;
}
void run() {
  int n;
  scanf("%d", &n);
  vector<int> x;
  for (int i = (0); i < (n); ++i) {
    char buff[10];
    int val;
    scanf("%s%d", buff, &val);
    x.push_back(buff[0] == 'w' ? +(val + 1) : -(val + 1));
  }
  int maxsell = 0;
  for (int i = (0); i < (n); ++i)
    if (x[i] < 0) maxsell = max(maxsell, -x[i]);
  vector<int> sellat(maxsell + 1, -1);
  for (int i = (0); i < (n); ++i)
    if (x[i] < 0) {
      assert(sellat[-x[i]] == -1);
      sellat[-x[i]] = i;
    }
  vector<int> winat(maxsell + 1, -1);
  for (int i = (0); i < (n); ++i)
    if (x[i] > 0 && x[i] <= maxsell && sellat[x[i]] != -1 && i < sellat[x[i]])
      winat[x[i]] = i;
  vector<string> get(maxsell + 1);
  get[1] = "1";
  for (int i = (2); i <= (maxsell); ++i) get[i] = twice(get[i - 1]);
  string ret = "";
  for (int i = maxsell; i >= 1; --i)
    if (winat[i] != -1 && sellat[i] != -1) {
      int a = winat[i], b = sellat[i];
      incr(ret, get[i]);
      for (int j = i - 1; j >= 1; --j)
        if (winat[j] != -1 && sellat[j] != -1) {
          int c = winat[j], d = sellat[j];
          if (!(d < a || b < c)) {
            winat[j] = -1, sellat[j] = -1;
          }
        }
    }
  if (((int)(ret).size()) == 0) ret = "0";
  printf("%s\n", ret.c_str());
}
int main() {
  run();
  return 0;
}
