#include <bits/stdc++.h>
using namespace std;
const int N = 2001, M = 5000;
string power[N];
int win[M], sell[M], rev[N];
vector<int> X;
bool vis[N];
string d(string str) {
  int carry = 0;
  for (int i = str.size() - 1; i >= 0; i--) {
    str[i] += (str[i] - '0') + carry;
    if (str[i] > '9') {
      carry = 1;
      str[i] -= 10;
    } else
      carry = 0;
  }
  if (carry) str = "1" + str;
  return str;
}
string add(string A, string B) {
  if (A.size() > B.size())
    B = string(A.size() - B.size(), '0') + B;
  else if (B.size() > A.size())
    A = string(B.size() - A.size(), '0') + A;
  int carry = 0;
  for (int i = A.size() - 1; i >= 0; i--) {
    A[i] += B[i] - '0' + carry;
    if (A[i] > '9') {
      carry = 1;
      A[i] -= 10;
    } else
      carry = 0;
  }
  if (carry) A = "1" + A;
  return A;
}
void solve(int from, int to) {
  int maxi = -1, w = -1, s = -1;
  fill(vis, vis + N, false);
  for (int i = from; i <= to; i++) {
    if (win[i] > -1) {
      vis[win[i]] = true;
      rev[win[i]] = i;
    } else if (vis[sell[i]] and sell[i] > maxi) {
      maxi = sell[i];
      w = rev[sell[i]];
      s = i;
    }
  }
  if (maxi == -1) return;
  X.push_back(maxi);
  solve(from, w - 1);
  solve(s + 1, to);
}
int main() {
  power[0] = "1";
  for (int i = 1; i < N; i++) power[i] = d(power[i - 1]);
  int n;
  cin >> n;
  fill(sell, sell + n, -1);
  fill(win, win + n, -1);
  for (int i = 0; i < n; i++) {
    string t;
    int x;
    cin >> t >> x;
    if (t == "win")
      win[i] = x;
    else
      sell[i] = x;
  }
  solve(0, n - 1);
  string ans = "0";
  for (int i : X) ans = add(ans, power[i]);
  cout << ans << endl;
  return 0;
}
