#include <bits/stdc++.h>
using namespace std;
const int N = 5e3 + 5, M = 2e4 + 5, inf = 0x3f3f3f3f, mod = 1e9 + 7;
int num[N][N];
int n, vis[N], cnt;
int ans[N];
pair<int, int> sell[N];
char str[50];
int main() {
  num[0][0] = num[0][1] = ans[0] = 1;
  for (int i = 1; i <= 2000; i++) {
    int w = 0;
    for (int j = 1; j <= num[i - 1][0]; j++) {
      num[i][j] = num[i - 1][j] * 2 + w;
      w = num[i][j] / 10;
      num[i][j] %= 10;
      ++num[i][0];
    }
    if (w) num[i][++num[i][0]] = 1;
  }
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%s%d", str, &x);
    if (str[0] == 's') {
      sell[++cnt] = {x, i};
      vis[i] = -1;
    } else
      vis[i] = x;
  }
  sort(sell + 1, sell + cnt + 1, greater<pair<int, int> >());
  for (int i = 1; i <= cnt; i++) {
    int x = sell[i].first, p = sell[i].second;
    for (int j = p; j >= 1 && vis[j] != -2; j--) {
      if (vis[j] == x) {
        for (int k = j; k <= p; k++) vis[k] = -2;
        int len = max(ans[0], num[x][0]), w = 0;
        for (int i = 1; i <= len; i++) {
          ans[i] += num[x][i] + w;
          w = ans[i] / 10;
          ans[i] %= 10;
        }
        if (w) ans[++len] = 1;
        ans[0] = len;
        break;
      }
    }
  }
  for (int i = ans[0]; i; i--) printf("%d", ans[i]);
  return 0;
}
