#include <bits/stdc++.h>
using namespace std;
const int SZ = 630;
const int N = 5001;
int n, m, mmax;
vector<int> s[2001], w[2001], ls, lw;
struct Node {
  int beg, end, va;
} node[N];
vector<int> e[N];
bool mk[N];
char dp[5000][2002];
class BigInt {
 public:
  int len;
  char str[SZ];
  BigInt() { len = 0; }
  BigInt(int num) {
    if (num == 0) {
      str[0] = 0;
      len = 1;
    } else {
      len = 0;
      while (num) {
        str[len++] = num % 10;
        num /= 10;
      }
    }
  }
  void multi_by(int num) {
    int p = 0;
    for (int i = 0; i < len; i++) {
      p += num * (int)str[i];
      str[i] = p % 10;
      p /= 10;
    }
    while (p) {
      str[len++] = p % 10;
      p /= 10;
    }
  }
  void add_by(int num) {
    int i = 0;
    str[len] = 0;
    while (num) {
      num += (int)str[i];
      str[i] = num % 10;
      num /= 10;
      ++i;
    }
    ++len;
    while (len > 0 && str[len - 1] == 0) --len;
  }
  void output() {
    for (int i = len - 1; i >= 0; i--) putchar(str[i] + '0');
  }
};
bool cmp(Node a, Node b) { return a.beg < b.beg; }
void dfs(int u) {
  if (mk[u]) return;
  mk[u] = 1;
  char *tmp = dp[u];
  for (int i = 0; i < e[u].size(); i++) {
    int v = e[u][i];
    dfs(v);
    if (i == 0)
      memcpy(tmp, dp[v], sizeof(dp[v]));
    else {
      int j = mmax, k = 0;
      for (; j >= 0; j--) {
        if (tmp[j] > dp[v][j]) {
          k = 1;
          break;
        } else if (tmp[j] < dp[v][j]) {
          k = -1;
          break;
        }
      }
      if (k == -1) memcpy(tmp, dp[v], sizeof(dp[v]));
    }
  }
  memcpy(dp[u], tmp, sizeof(tmp));
  dp[u][node[u].va] = '1';
}
int main() {
  char ch[10];
  int x;
  scanf("%d", &n);
  m = 0;
  mmax = 0;
  for (int i = 0; i < n; i++) {
    scanf("%s %d", ch, &x);
    if (ch[0] == 'w') {
      w[x].push_back(i);
      lw.push_back(i);
    } else {
      s[x].push_back(i);
      ls.push_back(i);
      if (x > mmax) mmax = x;
    }
  }
  for (int i = 0; i <= mmax; i++) {
    for (int j = 0; j < w[i].size(); j++)
      for (int k = 0; k < s[i].size(); k++)
        if (w[i][j] < s[i][k]) {
          Node nd;
          nd.beg = w[i][j], nd.end = s[i][k], nd.va = i;
          node[m++] = nd;
        }
  }
  sort(node, node + m, cmp);
  for (int i = 0; i < m; i++)
    for (int j = 0; j < m; j++) {
      if (i == j) continue;
      if (node[i].end < node[j].beg) {
        e[i].push_back(j);
      }
    }
  memset(dp, '0', sizeof(dp));
  memset(mk, 0, sizeof(mk));
  char ans[2002];
  memset(ans, '0', sizeof(ans));
  for (int i = 0; i < m; i++) {
    if (!mk[i]) {
      dfs(i);
      int j = mmax, k = 0;
      for (; j >= 0; j--) {
        if (ans[j] > dp[i][j]) {
          k = 1;
          break;
        } else if (ans[j] < dp[i][j]) {
          k = -1;
          break;
        }
      }
      if (k == -1) memcpy(ans, dp[i], sizeof(dp[i]));
    }
  }
  ans[mmax + 1] = '\0';
  BigInt res(0);
  for (int i = mmax; i >= 0; i--) {
    res.multi_by(2);
    if (ans[i] == '1') res.add_by(1);
  }
  res.output();
  putchar('\n');
  return 0;
}
