#include <bits/stdc++.h>
using namespace std;
struct bignum {
  int m[201];
  bignum() { memset(m, 0, sizeof(m)); }
  bignum &operator=(const int a) {
    memset(m, 0, sizeof(m));
    m[0] = a;
    for (int i = 0; i < 201; i++) {
      if (m[i] >= 1000) {
        m[i + 1] += m[i] / 1000;
        m[i] %= 1000;
      } else
        break;
    }
    return *this;
  }
  bignum &operator+=(const bignum a) {
    for (int i = 0; i < 201; i++) {
      m[i] += a.m[i];
      if (m[i] >= 1000) {
        m[i + 1] += m[i] / 1000;
        m[i] %= 1000;
      }
    }
    return *this;
  }
  bignum &operator*=(const int a) {
    int carry = 0;
    for (int i = 0; i < 201; i++) {
      m[i] = m[i] * a + carry;
      carry = 0;
      if (m[i] >= 1000) {
        carry = m[i] / 1000;
        m[i] %= 1000;
      }
    }
    return *this;
  }
  void print() {
    int now;
    now = 201 - 1;
    while (now >= 1 && m[now] == 0) now--;
    printf("%d", m[now--]);
    for (; now >= 0; now--) {
      printf("%03d", m[now]);
    }
    printf("\n");
  }
};
int n, x[5001];
char a[5001], aa[5];
bignum ans;
set<int> s;
void rec(int c, int d) {
  if (c >= d) return;
  int last[2010];
  memset(last, -1, sizeof(last));
  int tmp, l, r;
  tmp = -1;
  for (int i = c; i <= d; i++) {
    if (a[i] == 'w') {
      last[x[i]] = i;
    } else {
      if (tmp < x[i] && last[x[i]] != -1) {
        tmp = x[i];
        l = last[x[i]];
        r = i;
      }
    }
  }
  if (tmp == -1) return;
  rec(c, l - 1);
  rec(r + 1, d);
  s.insert(tmp);
}
int main() {
  scanf("%d", &n);
  ans = 0;
  for (int i = 0; i < n; i++) {
    scanf("%s%d", aa, &x[i]);
    a[i] = aa[0];
  }
  rec(0, n - 1);
  bignum btmp;
  btmp = 1;
  for (int i = 0; i <= 2001; i++) {
    if (s.find(i) != s.end()) {
      ans += btmp;
    }
    btmp *= 2;
  }
  ans.print();
  return 0;
}
