#include <bits/stdc++.h>
using namespace std;
const int mxn = (int)1e5 + 10;
string add(string x, string y) {
  int check = 9, c = 0;
  int m = max(x.length(), y.length());
  string s = "";
  int tt1 = m - x.length(), tt2 = m - y.length();
  x.insert(x.begin(), tt1, '0');
  y.insert(y.begin(), tt2, '0');
  for (int i = m - 1; i >= 0; i--) {
    int temp = x[i] - '0' + y[i] - '0' + c;
    c = 0;
    if (temp > check) {
      c = 1;
      temp -= 10;
    }
    s += (char)(temp + '0');
  }
  if (c == 1) s += '1';
  int l = s.length() - 1, ll = s.length() / 2;
  for (int i = 0; i < ll; i++) {
    char tx = s[i];
    s[i] = s[l - i];
    s[l - i] = tx;
  }
  return s;
}
int getpos(vector<int> v, int val) {
  if (v.size() == 0 || v[v.size() - 1] < val) return -1;
  int low = 0, high = v.size() - 1;
  while (low <= high) {
    int mid = (low + high) >> 1;
    if (val <= v[mid])
      high = mid - 1;
    else
      low = mid + 1;
  }
  return v[low];
}
vector<int> v[2048];
string dp[5048], val[2048];
bool sell[5048];
int amt[5048], n;
char ch[8];
string maxm(string s1, string s2) {
  if (s1.size() > s2.size()) return s1;
  if (s2.size() > s1.size()) return s2;
  return max(s1, s2);
}
int main() {
  val[0] = "1";
  for (int i = 1; i < 2048; i++) val[i] = add(val[i - 1], val[i - 1]);
  scanf("%d", &n);
  getchar();
  for (int i = 0; i < n; i++) {
    scanf("%s %d\n", ch, &amt[i]);
    sell[i] = ch[0] == 's';
    dp[i] = "0";
    if (sell[i]) v[amt[i]].push_back(i);
  }
  dp[n] = dp[n + 1] = "0";
  for (int i = n - 1; i >= 0; i--) {
    dp[i] = dp[i + 1];
    if (!sell[i]) {
      int pp = getpos(v[amt[i]], i);
      if (pp != -1 && pp > i) {
        string tmp = add(val[amt[i]], dp[pp + 1]);
        dp[i] = maxm(dp[i], tmp);
      }
    }
  }
  cout << dp[0] << endl;
}
