#include <bits/stdc++.h>
using namespace std;
struct BigNum {
  int sz;
  short dig[1000 + 10];
  BigNum(short d) {
    dig[1000] = d;
    sz = 1;
  }
  BigNum() { sz = 0; }
  BigNum operator+(BigNum B) {
    BigNum ret;
    while (sz < B.sz) dig[1000 - (sz++)] = 0;
    while (B.sz < sz) B.dig[1000 - (B.sz++)] = 0;
    int val, num, ost = 0;
    for (int i = 0; i < sz; ++i) {
      val = (dig[1000 - i] + B.dig[1000 - i] + ost);
      ret.dig[1000 - (ret.sz++)] = val % 10;
      ost = val / 10;
    }
    while (ost) {
      ret.dig[1000 - (ret.sz++)] = ost % 10;
      ost /= 10;
    }
    return ret;
  }
  void print() {
    for (int i = sz - 1; i >= 0; --i) printf("%d", dig[1000 - i]);
    printf("\n");
  }
  void trim() {
    while (sz > 0 && dig[1000 - sz + 1] == 0) --sz;
  }
};
BigNum pow2[2005], dp[5005];
void calc() {
  pow2[0].dig[1000 - (pow2[0].sz++)] = 1;
  for (int i = 1; i <= 2000; ++i) {
    int ost = 0, val, num;
    for (int j = 0; j < pow2[i - 1].sz; ++j) {
      val = pow2[i - 1].dig[1000 - j] * 2 + ost;
      num = val % 10;
      ost = val / 10;
      pow2[i].dig[1000 - (pow2[i].sz++)] = num;
    }
    while (ost) {
      pow2[i].dig[1000 - (pow2[i].sz++)] = ost % 10;
      ost /= 10;
    }
  }
}
BigNum max(BigNum A, BigNum B) {
  if (A.sz > B.sz) return A;
  if (A.sz < B.sz) return B;
  for (int i = A.sz - 1; i >= 0; --i) {
    if (A.dig[1000 - i] > B.dig[1000 - i]) return A;
    if (A.dig[1000 - i] < B.dig[1000 - i]) return B;
  }
  return A;
}
int SELLS[5005];
int PRODAJ[5005];
pair<int, int> U[5005];
int main() {
  calc();
  int n, x;
  scanf("%d", &n);
  char S[5];
  for (int i = 0; i < n; ++i) {
    scanf("%s %d", S, &x);
    SELLS[x] = -1;
    if (S[0] == 's') U[i] = make_pair(0, x);
    if (S[0] == 'w') U[i] = make_pair(1, x);
    dp[i].dig[1000 - (dp[i].sz++)] = 0;
  }
  for (int i = n - 1; i >= 0; --i) {
    if (U[i].first == 0) SELLS[U[i].second] = i;
    if (U[i].first == 1) PRODAJ[i] = SELLS[U[i].second];
  }
  BigNum maxv(0);
  for (int i = 0; i < n; ++i) {
    if (U[i].first == 1 && PRODAJ[i] != -1)
      dp[PRODAJ[i]] = maxv + pow2[U[i].second];
    maxv.trim();
    maxv = max(dp[i], maxv);
  }
  maxv.print();
  return 0;
}
