#include <bits/stdc++.h>
using namespace std;
vector<string> s;
int cost[5000];
int pred[5000];
struct tlong {
  int m[1000];
  int size;
  tlong() {
    for (int i = 0; i < 1000; i++) m[i] = 0;
    size = 1;
  }
};
int base = 1000000000;
void sum(tlong &a, const tlong &b) {
  a.size = max(a.size, b.size) + 1;
  int k = 0;
  for (int i = 0; i < max(a.size, b.size) + 1; i++) {
    int help = a.m[i];
    a.m[i] = (a.m[i] + b.m[i] + k) % base;
    k = (help + b.m[i] + k) / base;
  }
  while (a.m[a.size - 1] == 0) a.size--;
}
tlong max(tlong a, tlong b) {
  if (a.size > b.size)
    return a;
  else if (a.size < b.size)
    return b;
  int help = a.size;
  for (int i = help - 1; i >= 0; i--) {
    if (a.m[i] > b.m[i])
      return a;
    else if (a.m[i] < b.m[i])
      return b;
  }
  return a;
}
int f(int a) {
  int s = 0;
  while (a > 0) {
    s++;
    a /= 10;
  }
  return s;
}
tlong d[5000];
tlong maxim[5000];
tlong c[2001];
int main() {
  int n;
  c[0].m[0] = 1;
  for (int i = 1; i <= 2000; i++) {
    sum(c[i], c[i - 1]);
    sum(c[i], c[i - 1]);
  }
  memset(d, 0, sizeof(d));
  for (int i = 0; i < 5000; i++) pred[i] = -1;
  scanf("%d\n", &n);
  s.resize(n);
  memset(maxim, 0, sizeof(maxim));
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    scanf("%d\n", &cost[i]);
  }
  for (int i = 0; i < n; i++) {
    if (s[i][0] == 's') {
      for (int j = i - 1; j >= 0; j--)
        if (cost[j] == cost[i] && s[j][0] == 'w') {
          pred[i] = j;
          break;
        }
    }
  }
  for (int i = 0; i < n; i++) {
    if (s[i][0] == 's') {
      if (pred[i] != -1) {
        sum(d[i], c[cost[pred[i]]]);
        sum(d[i], maxim[pred[i]]);
      }
    }
    if (i == 0)
      maxim[i] = d[i];
    else
      maxim[i] = max(maxim[i - 1], d[i]);
  }
  tlong maxx;
  for (int i = 0; i < n; i++) maxx = max(maxx, d[i]);
  for (int i = maxx.size - 1; i >= 0; i--) {
    if (i != maxx.size - 1) {
      for (int j = 0; j < 9 - f(maxx.m[i]); j++) printf("0");
      printf("%d", maxx.m[i]);
    } else
      printf("%d", maxx.m[i]);
  }
  return 0;
}
