#include <bits/stdc++.h>
using namespace std;
struct bignum {
  long long num[300];
  int len;
  bignum() {
    memset(num, 0, sizeof(num));
    len = 1;
  }
  bignum(int x) {
    memset(num, 0, sizeof(num));
    len = 1;
    num[0] = x;
  }
  bignum operator+(const bignum &b) const {
    bignum c;
    c.len = max(len, b.len);
    for (int i = 0; i < c.len; ++i) c.num[i] = num[i] + b.num[i];
    for (int i = 0; i < len; ++i)
      if (c.num[i] >= 100000000) {
        c.num[i + 1]++;
        c.num[i] -= 100000000;
      }
    if (c.num[c.len] > 0) ++c.len;
    return c;
  }
  bignum operator*(const bignum &b) const {
    bignum c;
    c.len = len + b.len;
    for (int i = 0; i < len; ++i)
      for (int j = 0; j < b.len; ++j) c.num[i + j] += num[i] * b.num[j];
    for (int i = 0; i < c.len; ++i)
      if (c.num[i] >= 100000000) {
        c.num[i + 1] += c.num[i] / 100000000;
        c.num[i] %= 100000000;
      }
    while (c.len > 1 && c.num[c.len - 1] == 0) --c.len;
    return c;
  }
  void out() {
    printf("%d", num[len - 1]);
    for (int i = len - 2; i >= 0; --i) {
      printf("%08d", num[i]);
    }
  }
};
bignum max(const bignum &a, const bignum &b) {
  if (a.len > b.len) return a;
  if (b.len > a.len) return b;
  for (int i = a.len - 1; i >= 0; --i)
    if (a.num[i] > b.num[i])
      return a;
    else if (a.num[i] < b.num[i])
      return b;
  return a;
}
bignum pow_2(int x) {
  bignum ans(1);
  bignum t(2);
  while (x) {
    if (x & 1) ans = ans * t;
    t = t * t;
    x >>= 1;
  }
  return ans;
}
bignum f[5005];
int last[5005];
int main() {
  memset(last, 0xff, sizeof(last));
  int n;
  scanf("%d", &n);
  char s[5];
  int x;
  for (int i = 1; i <= n; ++i) {
    f[i] = f[i - 1];
    scanf("%s%d", s, &x);
    if (s[0] == 'w') {
      last[x] = i;
    } else {
      if (last[x] != -1) {
        bignum t = pow_2(x);
        f[i] = max(f[i], f[last[x] - 1] + t);
      }
    }
  }
  f[n].out();
  return 0;
}
