#include <bits/stdc++.h>
using namespace std;
void sum(vector<int>& a, vector<int>& b) {
  int r = 0;
  for (int i = 0; i < (int)a.size() || i < (int)b.size(); i++) {
    int c = (i < (int)a.size() ? a[i] : 0);
    c += (i < (int)b.size() ? b[i] : 0);
    c += r;
    r = c / 10;
    a[i] = c % 10;
  }
  if (r > 0) a.push_back(r);
}
vector<int> sum2(vector<int>& a, vector<int> b) {
  vector<int> ans;
  int r = 0;
  for (int i = 0; i < (int)a.size() || i < (int)b.size(); i++) {
    int c = (i < (int)a.size() ? a[i] : 0);
    c += (i < (int)b.size() ? b[i] : 0);
    c += r;
    r = c / 10;
    ans.push_back(c % 10);
  }
  if (r > 0) ans.push_back(r);
  return ans;
}
void mul(vector<int>& a, int n) {
  int r = 0;
  for (int i = 0; i < (int)a.size(); i++) {
    int c = a[i] * n + r;
    r = c / 10;
    a[i] = c % 10;
  }
  if (r > 0) a.push_back(r);
}
void sub(vector<int>& a, vector<int>& b) {
  for (int i = 0; i < (int)a.size(); i++) {
    int cur;
    if (i >= (int)b.size())
      cur = 0;
    else
      cur = b[i];
    if (a[i] < cur) {
      a[i] += 10;
      a[i + 1]--;
    }
    a[i] -= cur;
  }
  while (a.size() > 1 && a.back() == 0) a.pop_back();
}
bool biggerequal(vector<int>& a, vector<int>& b) {
  if (a.size() > b.size()) return 1;
  if (a.size() < b.size()) return 0;
  for (int i = a.size() - 1; i >= 0; i--) {
    if (a[i] > b[i]) return 1;
    if (a[i] < b[i]) return 0;
  }
  return 1;
}
const int mxX = 2002;
const int mxN = 5001;
vector<int> twoPower[mxX];
vector<int> ans[mxN];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  vector<int> cur = {1};
  for (int i = 0; i < mxX; i++) {
    twoPower[i] = cur;
    mul(cur, 2);
  }
  int n;
  cin >> n;
  vector<pair<bool, int>> ope(n);
  for (int i = 0; i < n; i++) {
    string op;
    cin >> op;
    int x;
    cin >> x;
    ope[i] = {op == "win", x};
  }
  map<int, int> mp;
  vector<int> best = {0};
  for (int i = n - 1; i >= 0; i--) {
    if (ope[i].first) {
      auto it = mp.find(ope[i].second);
      if (it != mp.end()) {
        vector<int> cur = sum2(twoPower[ope[i].second], ans[it->second]);
        if (biggerequal(cur, best)) {
          best = cur;
        }
      }
    } else {
      mp[ope[i].second] = i;
    }
    ans[i] = best;
  }
  for (int i = ans[0].size() - 1; i >= 0; i--) {
    cout << ans[0][i];
  }
}
