#include <bits/stdc++.h>
using namespace std;
const int maxn = 5050, maxm = 2020;
int N, ans[maxm], seg[4 * maxn], lazy[4 * maxn], is[maxm], last;
pair<int, int> ar[maxn];
vector<pair<int, pair<int, int> > > v;
vector<int> x;
int upd(int k, int b, int s, int x, int y) {
  if (x <= b && s <= y) {
    lazy[k] = 1;
    return seg[k] = s - b + 1;
  }
  if (s < x || y < b) return seg[k];
  int m = (b + s) >> 1;
  return seg[k] = upd(2 * k, b, m, x, y) + upd(2 * k + 1, m + 1, s, x, y);
}
int find(int k, int b, int s, int x, int y) {
  if (s < x || y < b) return 0;
  if (lazy[k]) return 1;
  if (x <= b && s <= y) return seg[k];
  int m = (b + s) >> 1;
  return find(2 * k, b, m, x, y) + find(2 * k + 1, m + 1, s, x, y);
}
void ekle() {
  int asd[maxm], cur = 0;
  memset(asd, 0, sizeof asd);
  asd[0] = 1;
  for (int i = x.size() - 1; i >= 0; i--) {
    while (cur < x[i]) {
      cur++;
      for (int j = 0; j <= 2000; j++) asd[j] = asd[j] * 2;
      for (int j = 0; j <= 2000; j++) {
        asd[j + 1] += asd[j] / 10;
        asd[j] = asd[j] - (asd[j] / 10) * 10;
      }
    }
    for (int j = 0; j <= 2000; j++) ans[j] += asd[j];
    for (int j = 0; j <= 2000; j++) {
      ans[j + 1] += ans[j] / 10;
      ans[j] = ans[j] - (ans[j] / 10) * 10;
      if (ans[j]) last = j;
    }
  }
}
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    string s;
    int a;
    cin >> s >> a;
    if (s[0] == 'w')
      ar[i] = pair<int, int>(1, a);
    else
      ar[i] = pair<int, int>(0, a);
  }
  for (int i = N; i >= 1; i--) {
    pair<int, int> a = ar[i];
    if (!a.first)
      is[a.second] = i;
    else if (is[a.second]) {
      v.push_back(pair<int, pair<int, int> >(a.second,
                                             pair<int, int>(i, is[a.second])));
      is[a.second] = 0;
    }
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) {
    if (find(1, 1, N, v[i].second.first + 1, v[i].second.second)) continue;
    upd(1, 1, N, v[i].second.first + 1, v[i].second.second);
    x.push_back(v[i].first);
  }
  ekle();
  for (int i = last; i >= 0; i--) printf("%d", ans[i]);
  puts("");
  return 0;
}
