#include <bits/stdc++.h>
using namespace std;
string dp[5001];
vector<int> win[2001];
int n;
string pow2[2001];
void multi2(string &ress, const string &p) {
  int flag = 0;
  ress = "";
  for (int i = 0; i < p.size(); i++) {
    ress += ((p[i] - '0') * 2 + flag) % 10 + '0';
    flag = ((p[i] - '0') * 2 + flag) / 10;
  }
  if (flag) ress += '1';
  int pos = ress.size() - 1;
  for (; pos >= 0 && ress[pos] == '0'; pos--)
    ;
  ress = ress.substr(0, pos + 1);
  if (ress == "") ress = "0";
  return;
}
void initPow2(void) {
  pow2[0] = "1";
  for (int i = 1; i <= 2000; i++) multi2(pow2[i], pow2[i - 1]);
  return;
}
void add(string &ress, string num) {
  while (ress.size() < num.size()) ress += '0';
  while (num.size() < ress.size()) num += '0';
  int flag = 0;
  for (int i = 0; i < ress.size(); i++) {
    char tRes = (ress[i] - '0' + num[i] - '0' + flag) % 10 + '0';
    flag = (ress[i] - '0' + num[i] - '0' + flag) / 10;
    ress[i] = tRes;
  }
  if (flag) ress += '1';
  int pos = ress.size() - 1;
  for (; pos >= 0 && ress[pos] == '0'; pos--)
    ;
  ress = ress.substr(0, pos + 1);
  if (ress == "") ress = "0";
  return;
}
bool larger(const string &str1, const string &str2) {
  if (str1.size() > str2.size()) return true;
  if (str1.size() < str2.size()) return false;
  for (int i = str1.size() - 1; i >= 0; i--) {
    if (str1[i] > str2[i]) return true;
    if (str1[i] < str2[i]) return false;
  }
  return false;
}
int main(void) {
  char enter;
  char input[10];
  int t;
  dp[0] = "0";
  initPow2();
  for (int i = 0; i <= 2000; i++) win[i].clear();
  scanf("%d%c", &n, &enter);
  for (int i = 1; i <= n; i++) {
    scanf("%s%c%d%c", input, &enter, &t, &enter);
    if (input[0] == 'w') {
      win[t].push_back(i);
      dp[i] = dp[i - 1];
    } else {
      dp[i] = dp[i - 1];
      if (win[t].size() != 0) {
        for (int j = 0; j < win[t].size(); j++) {
          string temp = pow2[t];
          add(temp, dp[win[t][j] - 1]);
          if (larger(temp, dp[i])) dp[i] = temp;
        }
      }
    }
  }
  reverse(dp[n].begin(), dp[n].end());
  printf("%s\n", dp[n].c_str());
  return 0;
}
