#include <bits/stdc++.h>
using namespace std;
const int BIGNUMSIZE = 1005;
class Bignum {
 private:
  int self[BIGNUMSIZE];
  int len;
  bool sign;

 public:
  Bignum(int x = 0) {
    clear();
    if (x < 0) {
      sign = true;
      x *= -1;
    } else {
      sign = false;
    }
    while (x > 0) {
      self[len++] = x % 10;
      x /= 10;
    }
    if (is_empty()) self[len++] = 0;
  }
  Bignum(const string &s) {
    clear();
    sign = (s[0] == '-');
    for (int i = s.length() - 1; i >= 0; i--) {
      if (s[i] != '-') push_back(s[i] - '0');
    }
  }
  int length() const { return len; }
  bool is_empty() const { return (len == 0); }
  bool is_negative() const { return sign; }
  bool is_zero() const { return (is_empty() || (len == 1 && self[0] == 0)); }
  void clear() {
    memset(self, 0, sizeof(self));
    len = 0;
  }
  void push_back(int x) { self[len++] = x; }
  void pop_back() { len--; }
  inline Bignum opposite() const {
    Bignum res = *this;
    res.sign = !res.sign;
    return res;
  }
  void refresh() {
    for (int i = 0; i < len; i++) {
      if (self[i] >= 10) {
        if (i == len - 1) {
          push_back(self[i] / 10);
        } else {
          self[i + 1] += self[i] / 10;
        }
        self[i] %= 10;
      }
    }
    for (int i = 0; i < len; i++) {
      if (self[i] < 0) {
        if (i == len - 1) {
          self[i] += 10;
          push_back(-1);
        } else {
          self[i] += 10;
          self[i + 1] -= 1;
        }
      }
    }
    while (!is_empty() && self[len - 1] == 0) {
      pop_back();
    }
    if (is_empty()) self[len++] = 0;
  }
  int &operator[](const int x) { return self[x]; }
  const int &operator[](const int x) const { return self[x]; }
  friend Bignum operator+(const Bignum &a, const Bignum &b) {
    Bignum res;
    if (a.sign == b.sign) {
      res = a;
      for (int i = 0; i < b.len; i++) {
        if (i < res.len) {
          res[i] += b[i];
        } else {
          res.push_back(b[i]);
        }
      }
    } else {
      if (a < b) {
        res = b;
        for (int i = 0; i < a.len; i++) {
          if (i < b.len) {
            res[i] -= a[i];
          } else {
            res.push_back(a[i]);
          }
        }
      } else {
        res = a;
        for (int i = 0; i < b.len; i++) {
          if (i < a.len) {
            res[i] -= b[i];
          } else {
            res.push_back(b[i]);
          }
        }
      }
    }
    res.refresh();
    return res;
  }
  friend Bignum operator+(const Bignum &a, const int &b) {
    return (a + Bignum(b));
  }
  Bignum &operator+=(const Bignum &b) {
    *this = *this + b;
    return *this;
  }
  friend Bignum operator-(const Bignum &a, const Bignum &b) {
    return (a + b.opposite());
  }
  friend Bignum operator-(const Bignum &a, const int &b) {
    return (a - Bignum(b));
  }
  Bignum &operator-=(const Bignum &b) {
    *this = *this - b;
    return *this;
  }
  friend Bignum operator*(const Bignum &a, const Bignum &b) {
    Bignum res;
    res.len = a.len + b.len;
    for (int i = 0; i < res.len; i++)
      for (int j = 0; j < b.len; j++) {
        res[i + j] += a[i] * b[j];
      }
    res.sign = a.sign ^ b.sign;
    res.refresh();
    return res;
  }
  friend Bignum operator*(Bignum a, int b) { return (a * Bignum(b)); }
  Bignum &operator*=(const Bignum &b) {
    *this = *this * b;
    return *this;
  }
  friend Bignum operator/(const Bignum &a, const Bignum &b) {
    Bignum res;
    if (a.len < b.len || (a.len == b.len && a < b) || b.is_zero()) {
      res = 0;
    } else {
      int sublen = a.len - b.len;
      Bignum t = a;
      t.sign = false;
      for (int i = sublen; i >= 0; i--) {
        Bignum c = Bignum(10) ^ i;
        Bignum d = b * c;
        d.sign = false;
        while (true) {
          t -= d;
          if (t.sign) {
            t += d;
            break;
          } else {
            res += c;
            if (t.is_zero()) break;
          }
        }
      }
    }
    res.sign = a.sign ^ b.sign;
    res.refresh();
    return res;
  }
  Bignum &operator/=(const Bignum &b) {
    *this = *this / b;
    return *this;
  }
  Bignum &operator/=(const int &n) {
    Bignum &a = *this;
    Bignum res;
    res.pop_back();
    stack<int> s;
    int div = 0;
    for (int i = a.length() - 1; i >= 0; i--) {
      div = div * 10 + a[i];
      s.push(div / n);
      div %= n;
    }
    while (!s.empty()) {
      res.push_back(s.top());
      s.pop();
    }
    res.sign = a.sign ^ (n < 0);
    res.refresh();
    *this = res;
    return *this;
  }
  friend Bignum operator/(Bignum a, int b) {
    Bignum res = a;
    res /= b;
    return res;
  }
  Bignum operator^(int x) {
    Bignum a = *this;
    Bignum res(1);
    while (x > 0) {
      if (x % 2 == 1) res *= a;
      a *= a;
      x /= 2;
    }
    return res;
  }
  friend bool operator==(const Bignum &a, const Bignum &b) {
    if (a.len != b.len) return false;
    for (int i = 0; i < a.len; i++) {
      if (a[i] != b[i]) return false;
    }
    return true;
  }
  friend bool operator<(const Bignum &a, const Bignum &b) {
    if (a.len != b.len) return (a.len < b.len);
    int len = a.len;
    for (int i = len - 1; i >= 0; i--) {
      if (a[i] != b[i]) return (a[i] < b[i]);
    }
    return false;
  }
  friend ostream &operator<<(ostream &out, const Bignum &num) {
    if (num.is_empty()) {
      out << 0;
      return out;
    }
    if (num.sign) cout << '-';
    for (int i = num.len - 1; i >= 0; i--) {
      out << num[i];
    }
    return out;
  }
};
class Operation {
 public:
  bool type;
  int x;
  Operation(bool t, int i) : type(t), x(i) {}
  Operation() {}
};
class Sell {
 public:
  int pos;
  int x;
  Sell(int p, int i) : pos(p), x(i) {}
  Sell() {}
  friend bool operator>(const Sell &A, const Sell &B) { return (A.x > B.x); }
};
Bignum ksm(int x) {
  Bignum one = 1;
  if (x == 0) return one;
  Bignum ret;
  ret = ksm(x / 2);
  ret = ret * ret;
  if (x % 2) ret = ret * 2;
  return ret;
}
int get_winpos(const Sell &sell);
const int MAX = 5005;
Operation opts[MAX];
vector<Sell> sells;
bool visited[MAX];
char s[10];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    sells.clear();
    memset(visited, false, sizeof(visited));
    int t, x;
    for (int i = 1; i <= n; i++) {
      scanf("%s %d", s, &x);
      t = (s[0] == 'w' ? 0 : 1);
      opts[i] = Operation(t, x);
      if (t == 1) sells.push_back(Sell(i, x));
    }
    sort(sells.begin(), sells.end(), greater<Sell>());
    Bignum two(2);
    Bignum res;
    for (auto sell : sells) {
      if (visited[sell.pos]) continue;
      int winpos = get_winpos(sell);
      if (winpos > 0) {
        for (int j = winpos; j <= sell.pos; j++) visited[j] = true;
        res += two ^ sell.x;
      }
    }
    cout << res << endl;
  }
  return 0;
}
int get_winpos(const Sell &sell) {
  for (int i = sell.pos - 1; i >= 1; i--) {
    if (visited[i]) return 0;
    if (opts[i].type == 0 && opts[i].x == sell.x) return i;
  }
  return 0;
}
