#include <bits/stdc++.h>
using namespace std;
int n, x;
char s[20];
pair<int, int> arr[5005];
string dp[5005];
string powers[5005];
string add(string a, string b) {
  if (a.size() != b.size()) {
    string ne = "";
    for (int i = 0, to = max(a.size(), b.size()) - min(a.size(), b.size());
         i < to; i++) {
      ne += '0';
    }
    if (a.size() > b.size()) {
      b = ne + b;
    } else {
      a = ne + a;
    }
  }
  string ret = "";
  bool rem = 0;
  for (int i = ((int)a.size()) - 1; i >= 0; i--) {
    int x = a[i] - '0', y = b[i] - '0', res;
    res = x + y + rem;
    if (res >= 10)
      rem = true;
    else
      rem = false;
    ret += (char)((res % 10) + '0');
  }
  if (rem) ret += '1';
  reverse(ret.begin(), ret.end());
  return ret;
}
string solve(int idx) {
  if (idx >= n) return "0";
  if (dp[idx] != "") return dp[idx];
  string takeIt = "0", leaveIt;
  int cur = idx, cur2 = idx + 1;
  for (; cur < n; cur++) {
    if (arr[cur].first == 1 && arr[cur].second == arr[idx].second) {
      takeIt = powers[arr[cur].second];
      break;
    }
  }
  for (; cur < n; cur++) {
    if (arr[cur].first == 0) break;
  }
  for (; cur2 < n; cur2++) {
    if (arr[cur2].first == 0) break;
  }
  takeIt = add(takeIt, solve(cur));
  leaveIt = solve(cur2);
  if (takeIt.size() != leaveIt.size()) {
    if (takeIt.size() > leaveIt.size())
      dp[idx] = takeIt;
    else
      dp[idx] = leaveIt;
  } else {
    dp[idx] = max(takeIt, leaveIt);
  }
  return dp[idx];
}
int main() {
  powers[0] = "1";
  for (int i = 1; i < 5002; i++) {
    powers[i] = add(powers[i - 1], powers[i - 1]);
  }
  scanf("%d", &n);
  int st = n;
  for (int i = 0; i < n; i++) {
    scanf("%s %d", s, &x);
    if (s[0] == 'w') {
      arr[i].first = 0;
      if (st == n) st = i;
    } else
      arr[i].first = 1;
    arr[i].second = x;
  }
  printf("%s\n", solve(st).c_str());
  return 0;
}
