#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <limits>
#include <map>
using namespace std;

const int MAXD=10010;  // ����
const int DIG=9, BASE=1000000000;
const unsigned long long BOUND = numeric_limits<unsigned long long>::max()-(unsigned long long)BASE*BASE;

struct BigNum
{
    int D, digits[MAXD/DIG+2];

    inline void trim ()
    {
        while (D > 1 && digits [D - 1] == 0)
            D--;
    }

    inline void init (long long x)
    {
        memset (digits, 0, sizeof (digits));
        D = 0;

        do
        {
            digits [D++] = x % BASE;
            x /= BASE;
        }
        while (x > 0);
    }

    inline BigNum (long long x)
    {
        init (x);
    }

    inline BigNum (int x = 0)
    {
        init (x);
    }

    inline BigNum (char *s)
    {
        memset (digits, 0, sizeof (digits));
        int len = strlen (s), first = (len + DIG - 1) % DIG + 1;
        D = (len + DIG - 1) / DIG;

        for (int i = 0; i < first; i++)
            digits [D - 1] = digits [D - 1] * 10 + s [i] - '0';

        for (int i = first, d = D - 2; i < len; i += DIG, d--)
            for (int j = i; j < i + DIG; j++)
                digits [d] = digits [d] * 10 + s [j] - '0';

        trim ();
    }

    inline char *str ()
    {
        trim ();
        char *buf = new char [DIG * D + 1];
        int pos = 0, d = digits [D - 1];

        do
        {
            buf [pos++] = d % 10 + '0';
            d /= 10;
        }
        while (d > 0);

        reverse (buf, buf + pos);

        for (int i = D - 2; i >= 0; i--, pos += DIG)
            for (int j = DIG - 1, t = digits [i]; j >= 0; j--)
            {
                buf [pos + j] = t % 10 + '0';
                t /= 10;
            }

        buf [pos] = '\0';
        return buf;
    }

    inline bool operator < (const BigNum &o) const  // ����С��
    {
        if (D != o.D)
            return D < o.D;

        for (int i = D - 1; i >= 0; i--)
            if (digits [i] != o.digits [i])
                return digits [i] < o.digits [i];

        return false;
    }

    inline bool operator == (const BigNum &o) const   // �����
    {
        if (D != o.D)
            return false;

        for (int i = 0; i < D; i++)
            if (digits [i] != o.digits [i])
                return false;

        return true;
    }

    inline BigNum operator << (int p) const  // ��������
    {
        BigNum temp;
        temp.D = D + p;

        for (int i = 0; i < D; i++)
            temp.digits [i + p] = digits [i];

        for (int i = 0; i < p; i++)
            temp.digits [i] = 0;

        return temp;
    }

    inline BigNum operator >> (int p) const  // ��������
    {
        BigNum temp;
        temp.D = D - p;

        for (int i = 0; i < D - p; i++)
            temp.digits [i] = digits [i + p];

        for (int i = D - p; i < D; i++)
            temp.digits [i] = 0;

        return temp;
    }

    inline BigNum range (int a, int b) const
    {
        BigNum temp = 0;
        temp.D = b - a;

        for (int i = 0; i < temp.D; i++)
            temp.digits [i] = digits [i + a];

        return temp;
    }

    inline BigNum operator + (const BigNum &o) const  // �����
    {
        BigNum sum = o;
        int carry = 0;

        for (sum.D = 0; sum.D < D || carry > 0; sum.D++)
        {
            sum.digits [sum.D] += (sum.D < D ? digits [sum.D] : 0) + carry;

            if (sum.digits [sum.D] >= BASE)
            {
                sum.digits [sum.D] -= BASE;
                carry = 1;
            }
            else
                carry = 0;
        }

        sum.D = max (sum.D, o.D);
        sum.trim ();
        return sum;
    }

    inline BigNum operator - (const BigNum &o) const  // �����
    {
        BigNum diff = *this;

        for (int i = 0, carry = 0; i < o.D || carry > 0; i++)
        {
            diff.digits [i] -= (i < o.D ? o.digits [i] : 0) + carry;

            if (diff.digits [i] < 0)
            {
                diff.digits [i] += BASE;
                carry = 1;
            }
            else
                carry = 0;
        }

        diff.trim ();
        return diff;
    }

    inline BigNum operator * (const BigNum &o) const  // �����
    {
        BigNum prod = 0;
        unsigned long long sum = 0, carry = 0;

        for (prod.D = 0; prod.D < D + o.D - 1 || carry > 0; prod.D++)
        {
            sum = carry % BASE;
            carry /= BASE;

            for (int j = max (prod.D - o.D + 1, 0); j <= min (D - 1, prod.D); j++)
            {
                sum += (unsigned long long) digits [j] * o.digits [prod.D - j];

                if (sum >= BOUND)
                {
                    carry += sum / BASE;
                    sum %= BASE;
                }
            }

            carry += sum / BASE;
            prod.digits [prod.D] = sum % BASE;
        }

        prod.trim ();
        return prod;
    }

    inline double double_div (const BigNum &o) const
    {
        double val = 0, oval = 0;
        int num = 0, onum = 0;

        for (int i = D - 1; i >= max (D - 3, 0); i--, num++)
            val = val * BASE + digits [i];

        for (int i = o.D - 1; i >= max (o.D - 3, 0); i--, onum++)
            oval = oval * BASE + o.digits [i];

        return val / oval * (D - num > o.D - onum ? BASE : 1);
    }

    inline pair <BigNum, BigNum> divmod (const BigNum &o) const  // ���ģ
    {
        BigNum quot = 0, rem = *this, temp;

        for (int i = D - o.D; i >= 0; i--)
        {
            temp = rem.range (i, rem.D);
            int div = (int) temp.double_div (o);
            BigNum mult = o * div;

            while (div > 0 && temp < mult)
            {
                mult = mult - o;
                div--;
            }

            while (div + 1 < BASE && !(temp < mult + o))
            {
                mult = mult + o;
                div++;
            }

            rem = rem - (o * div << i);

            if (div > 0)
            {
                quot.digits [i] = div;
                quot.D = max (quot.D, i + 1);
            }
        }

        quot.trim ();
        rem.trim ();
        return make_pair (quot, rem);
    }

    inline BigNum operator / (const BigNum &o) const  // �����
    {
        return divmod (o).first;
    }

    inline BigNum operator % (const BigNum &o) const  // ����ģ
    {
        return divmod (o).second;
    }

    inline BigNum power (int exp) const  // ������
    {
        BigNum p = 1, temp = *this;

        while (exp > 0)
        {
            if (exp & 1) p = p * temp;
            if (exp > 1) temp = temp * temp;
            exp >>= 1;
        }

        return p;
    }
};

typedef pair<string, int> Item;

Item it[5010];
bool used[5010];

BigNum calc(int x);

int main()
{
	int n;
	BigNum tt;
	map< int, int, greater<int> > mp;
	map< int, int, greater<int> >::iterator ptr;

	cin>>n;
	for(int i=0; i<n; i++)
	{
		cin>>it[i].first>>it[i].second;
		if( it[i].first[0] == 's' )
			mp.insert(make_pair(it[i].second, i));
	}

	BigNum ans(0);
	for(ptr=mp.begin(); ptr!=mp.end(); ptr++)
		for(int i=ptr->second; i>=0; i--)
		{
			if( used[i] )
				break;
			if( it[i].first[0]=='w' && it[i].second==ptr->first )
			{
				ans = ans+calc(ptr->first);
				for(int j=i; j<=ptr->second; j++)
					used[j] = 1;
				break;
			}
		}
	printf("%s\n", ans.str());

	return 0;
}

BigNum calc(int x)
{
	BigNum t;

	if( x < 31 )
		return BigNum(1<<x);  // bug
	t = calc(x/2);
	t = t*t;
	if( x%2 == 1 )
		t = t*BigNum(2);

	return t;
}


#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <limits>
#include <map>
using namespace std;

const int MAXD=1010;  // ����
const int DIG=9, BASE=1000000000;
const unsigned long long BOUND = numeric_limits<unsigned long long>::max()-(unsigned long long)BASE*BASE;

struct BigNum
{
    int D, digits[MAXD/DIG+2];

    inline void trim ()
    {
        while (D > 1 && digits [D - 1] == 0)
            D--;
    }

    inline void init (long long x)
    {
        memset (digits, 0, sizeof (digits));
        D = 0;

        do
        {
            digits [D++] = x % BASE;
            x /= BASE;
        }
        while (x > 0);
    }

    inline BigNum (long long x)
    {
        init (x);
    }

    inline BigNum (int x = 0)
    {
        init (x);
    }

    inline BigNum (char *s)
    {
        memset (digits, 0, sizeof (digits));
        int len = strlen (s), first = (len + DIG - 1) % DIG + 1;
        D = (len + DIG - 1) / DIG;

        for (int i = 0; i < first; i++)
            digits [D - 1] = digits [D - 1] * 10 + s [i] - '0';

        for (int i = first, d = D - 2; i < len; i += DIG, d--)
            for (int j = i; j < i + DIG; j++)
                digits [d] = digits [d] * 10 + s [j] - '0';

        trim ();
    }

    inline char *str ()
    {
        trim ();
        char *buf = new char [DIG * D + 1];
        int pos = 0, d = digits [D - 1];

        do
        {
            buf [pos++] = d % 10 + '0';
            d /= 10;
        }
        while (d > 0);

        reverse (buf, buf + pos);

        for (int i = D - 2; i >= 0; i--, pos += DIG)
            for (int j = DIG - 1, t = digits [i]; j >= 0; j--)
            {
                buf [pos + j] = t % 10 + '0';
                t /= 10;
            }

        buf [pos] = '\0';
        return buf;
    }

    inline bool operator < (const BigNum &o) const  // ����С��
    {
        if (D != o.D)
            return D < o.D;

        for (int i = D - 1; i >= 0; i--)
            if (digits [i] != o.digits [i])
                return digits [i] < o.digits [i];

        return false;
    }

    inline bool operator == (const BigNum &o) const   // �����
    {
        if (D != o.D)
            return false;

        for (int i = 0; i < D; i++)
            if (digits [i] != o.digits [i])
                return false;

        return true;
    }

    inline BigNum operator << (int p) const  // ��������
    {
        BigNum temp;
        temp.D = D + p;

        for (int i = 0; i < D; i++)
            temp.digits [i + p] = digits [i];

        for (int i = 0; i < p; i++)
            temp.digits [i] = 0;

        return temp;
    }

    inline BigNum operator >> (int p) const  // ��������
    {
        BigNum temp;
        temp.D = D - p;

        for (int i = 0; i < D - p; i++)
            temp.digits [i] = digits [i + p];

        for (int i = D - p; i < D; i++)
            temp.digits [i] = 0;

        return temp;
    }

    inline BigNum range (int a, int b) const
    {
        BigNum temp = 0;
        temp.D = b - a;

        for (int i = 0; i < temp.D; i++)
            temp.digits [i] = digits [i + a];

        return temp;
    }

    inline BigNum operator + (const BigNum &o) const  // �����
    {
        BigNum sum = o;
        int carry = 0;

        for (sum.D = 0; sum.D < D || carry > 0; sum.D++)
        {
            sum.digits [sum.D] += (sum.D < D ? digits [sum.D] : 0) + carry;

            if (sum.digits [sum.D] >= BASE)
            {
                sum.digits [sum.D] -= BASE;
                carry = 1;
            }
            else
                carry = 0;
        }

        sum.D = max (sum.D, o.D);
        sum.trim ();
        return sum;
    }

    inline BigNum operator - (const BigNum &o) const  // �����
    {
        BigNum diff = *this;

        for (int i = 0, carry = 0; i < o.D || carry > 0; i++)
        {
            diff.digits [i] -= (i < o.D ? o.digits [i] : 0) + carry;

            if (diff.digits [i] < 0)
            {
                diff.digits [i] += BASE;
                carry = 1;
            }
            else
                carry = 0;
        }

        diff.trim ();
        return diff;
    }

    inline BigNum operator * (const BigNum &o) const  // �����
    {
        BigNum prod = 0;
        unsigned long long sum = 0, carry = 0;

        for (prod.D = 0; prod.D < D + o.D - 1 || carry > 0; prod.D++)
        {
            sum = carry % BASE;
            carry /= BASE;

            for (int j = max (prod.D - o.D + 1, 0); j <= min (D - 1, prod.D); j++)
            {
                sum += (unsigned long long) digits [j] * o.digits [prod.D - j];

                if (sum >= BOUND)
                {
                    carry += sum / BASE;
                    sum %= BASE;
                }
            }

            carry += sum / BASE;
            prod.digits [prod.D] = sum % BASE;
        }

        prod.trim ();
        return prod;
    }

    inline double double_div (const BigNum &o) const
    {
        double val = 0, oval = 0;
        int num = 0, onum = 0;

        for (int i = D - 1; i >= max (D - 3, 0); i--, num++)
            val = val * BASE + digits [i];

        for (int i = o.D - 1; i >= max (o.D - 3, 0); i--, onum++)
            oval = oval * BASE + o.digits [i];

        return val / oval * (D - num > o.D - onum ? BASE : 1);
    }

    inline pair <BigNum, BigNum> divmod (const BigNum &o) const  // ���ģ
    {
        BigNum quot = 0, rem = *this, temp;

        for (int i = D - o.D; i >= 0; i--)
        {
            temp = rem.range (i, rem.D);
            int div = (int) temp.double_div (o);
            BigNum mult = o * div;

            while (div > 0 && temp < mult)
            {
                mult = mult - o;
                div--;
            }

            while (div + 1 < BASE && !(temp < mult + o))
            {
                mult = mult + o;
                div++;
            }

            rem = rem - (o * div << i);

            if (div > 0)
            {
                quot.digits [i] = div;
                quot.D = max (quot.D, i + 1);
            }
        }

        quot.trim ();
        rem.trim ();
        return make_pair (quot, rem);
    }

    inline BigNum operator / (const BigNum &o) const  // �����
    {
        return divmod (o).first;
    }

    inline BigNum operator % (const BigNum &o) const  // ����ģ
    {
        return divmod (o).second;
    }

    inline BigNum power (int exp) const  // ������
    {
        BigNum p = 1, temp = *this;

        while (exp > 0)
        {
            if (exp & 1) p = p * temp;
            if (exp > 1) temp = temp * temp;
            exp >>= 1;
        }

        return p;
    }
};

typedef pair<string, int> Item;

Item it[5010];
bool used[5010];

BigNum calc(int x);

int main()
{
	int n;
	string str;
	map< int, int, greater<int> > mp;
	map< int, int, greater<int> >::iterator ptr;

	cin>>n;
	for(int i=0; i<n; i++)
	{
		cin>>it[i].first>>it[i].second;
		if( it[i].first[0] == 's' )
			mp.insert(make_pair(it[i].second, i));
	}

	BigNum ans(0);
	for(ptr=mp.begin(); ptr!=mp.end(); ptr++)
	{
		for(int i=ptr->second; i>=0; i--)
		{
			if( used[i] )
				break;
			if( it[i].first[0]=='w' && it[i].second==ptr->first )
			{
				ans = ans+calc(ptr->first);
				for(int j=i; j<=ptr->second; j++)
					used[j] = 1;
				break;
			}
		}
	}
	printf("%s\n", ans.str());

	return 0;
}

BigNum calc(int x)
{
	BigNum t;

	if( x < 63 )
		return BigNum(1<<x);
	t = calc(x/2);
	if( x%2 == 0 )
		return t*t;
	else
		return t*t*BigNum(2);
}


#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <limits>
#include <map>
using namespace std;

const int MAXD=10010;  // ����
const int DIG=9, BASE=1000000000;
const unsigned long long BOUND = numeric_limits<unsigned long long>::max()-(unsigned long long)BASE*BASE;

struct BigNum
{
    int D, digits[MAXD/DIG+2];

    inline void trim ()
    {
        while (D > 1 && digits [D - 1] == 0)
            D--;
    }

    inline void init (long long x)
    {
        memset (digits, 0, sizeof (digits));
        D = 0;

        do
        {
            digits [D++] = x % BASE;
            x /= BASE;
        }
        while (x > 0);
    }

    inline BigNum (long long x)
    {
        init (x);
    }

    inline BigNum (int x = 0)
    {
        init (x);
    }

    inline BigNum (char *s)
    {
        memset (digits, 0, sizeof (digits));
        int len = strlen (s), first = (len + DIG - 1) % DIG + 1;
        D = (len + DIG - 1) / DIG;

        for (int i = 0; i < first; i++)
            digits [D - 1] = digits [D - 1] * 10 + s [i] - '0';

        for (int i = first, d = D - 2; i < len; i += DIG, d--)
            for (int j = i; j < i + DIG; j++)
                digits [d] = digits [d] * 10 + s [j] - '0';

        trim ();
    }

    inline char *str ()
    {
        trim ();
        char *buf = new char [DIG * D + 1];
        int pos = 0, d = digits [D - 1];

        do
        {
            buf [pos++] = d % 10 + '0';
            d /= 10;
        }
        while (d > 0);

        reverse (buf, buf + pos);

        for (int i = D - 2; i >= 0; i--, pos += DIG)
            for (int j = DIG - 1, t = digits [i]; j >= 0; j--)
            {
                buf [pos + j] = t % 10 + '0';
                t /= 10;
            }

        buf [pos] = '\0';
        return buf;
    }

    inline bool operator < (const BigNum &o) const  // ����С��
    {
        if (D != o.D)
            return D < o.D;

        for (int i = D - 1; i >= 0; i--)
            if (digits [i] != o.digits [i])
                return digits [i] < o.digits [i];

        return false;
    }

    inline bool operator == (const BigNum &o) const   // �����
    {
        if (D != o.D)
            return false;

        for (int i = 0; i < D; i++)
            if (digits [i] != o.digits [i])
                return false;

        return true;
    }

    inline BigNum operator << (int p) const  // ��������
    {
        BigNum temp;
        temp.D = D + p;

        for (int i = 0; i < D; i++)
            temp.digits [i + p] = digits [i];

        for (int i = 0; i < p; i++)
            temp.digits [i] = 0;

        return temp;
    }

    inline BigNum operator >> (int p) const  // ��������
    {
        BigNum temp;
        temp.D = D - p;

        for (int i = 0; i < D - p; i++)
            temp.digits [i] = digits [i + p];

        for (int i = D - p; i < D; i++)
            temp.digits [i] = 0;

        return temp;
    }

    inline BigNum range (int a, int b) const
    {
        BigNum temp = 0;
        temp.D = b - a;

        for (int i = 0; i < temp.D; i++)
            temp.digits [i] = digits [i + a];

        return temp;
    }

    inline BigNum operator + (const BigNum &o) const  // �����
    {
        BigNum sum = o;
        int carry = 0;

        for (sum.D = 0; sum.D < D || carry > 0; sum.D++)
        {
            sum.digits [sum.D] += (sum.D < D ? digits [sum.D] : 0) + carry;

            if (sum.digits [sum.D] >= BASE)
            {
                sum.digits [sum.D] -= BASE;
                carry = 1;
            }
            else
                carry = 0;
        }

        sum.D = max (sum.D, o.D);
        sum.trim ();
        return sum;
    }

    inline BigNum operator - (const BigNum &o) const  // �����
    {
        BigNum diff = *this;

        for (int i = 0, carry = 0; i < o.D || carry > 0; i++)
        {
            diff.digits [i] -= (i < o.D ? o.digits [i] : 0) + carry;

            if (diff.digits [i] < 0)
            {
                diff.digits [i] += BASE;
                carry = 1;
            }
            else
                carry = 0;
        }

        diff.trim ();
        return diff;
    }

    inline BigNum operator * (const BigNum &o) const  // �����
    {
        BigNum prod = 0;
        unsigned long long sum = 0, carry = 0;

        for (prod.D = 0; prod.D < D + o.D - 1 || carry > 0; prod.D++)
        {
            sum = carry % BASE;
            carry /= BASE;

            for (int j = max (prod.D - o.D + 1, 0); j <= min (D - 1, prod.D); j++)
            {
                sum += (unsigned long long) digits [j] * o.digits [prod.D - j];

                if (sum >= BOUND)
                {
                    carry += sum / BASE;
                    sum %= BASE;
                }
            }

            carry += sum / BASE;
            prod.digits [prod.D] = sum % BASE;
        }

        prod.trim ();
        return prod;
    }

    inline double double_div (const BigNum &o) const
    {
        double val = 0, oval = 0;
        int num = 0, onum = 0;

        for (int i = D - 1; i >= max (D - 3, 0); i--, num++)
            val = val * BASE + digits [i];

        for (int i = o.D - 1; i >= max (o.D - 3, 0); i--, onum++)
            oval = oval * BASE + o.digits [i];

        return val / oval * (D - num > o.D - onum ? BASE : 1);
    }

    inline pair <BigNum, BigNum> divmod (const BigNum &o) const  // ���ģ
    {
        BigNum quot = 0, rem = *this, temp;

        for (int i = D - o.D; i >= 0; i--)
        {
            temp = rem.range (i, rem.D);
            int div = (int) temp.double_div (o);
            BigNum mult = o * div;

            while (div > 0 && temp < mult)
            {
                mult = mult - o;
                div--;
            }

            while (div + 1 < BASE && !(temp < mult + o))
            {
                mult = mult + o;
                div++;
            }

            rem = rem - (o * div << i);

            if (div > 0)
            {
                quot.digits [i] = div;
                quot.D = max (quot.D, i + 1);
            }
        }

        quot.trim ();
        rem.trim ();
        return make_pair (quot, rem);
    }

    inline BigNum operator / (const BigNum &o) const  // �����
    {
        return divmod (o).first;
    }

    inline BigNum operator % (const BigNum &o) const  // ����ģ
    {
        return divmod (o).second;
    }

    inline BigNum power (int exp) const  // ������
    {
        BigNum p = 1, temp = *this;

        while (exp > 0)
        {
            if (exp & 1) p = p * temp;
            if (exp > 1) temp = temp * temp;
            exp >>= 1;
        }

        return p;
    }
};

typedef pair<string, int> Item;

Item it[5010];
bool used[5010];

BigNum calc(int x);

int main()
{
	int n;
	string str;
	map< int, int, greater<int> > mp;
	map< int, int, greater<int> >::iterator ptr;

	cin>>n;
	for(int i=0; i<n; i++)
	{
		cin>>it[i].first>>it[i].second;
		if( it[i].first[0] == 's' )
			mp.insert(make_pair(it[i].second, i));
	}

	BigNum ans(0);
	for(ptr=mp.begin(); ptr!=mp.end(); ptr++)
	{
		for(int i=ptr->second; i>=0; i--)
		{
			if( used[i] )
				break;
			if( it[i].first[0]=='w' && it[i].second==ptr->first )
			{
				ans = ans+calc(ptr->first);
				for(int j=i; j<=ptr->second; j++)
					used[j] = 1;
				break;
			}
		}
	}
	printf("%s\n", ans.str());

	return 0;
}

BigNum calc(int x)
{
	BigNum t;

	if( x < 63 )
		return BigNum(1<<x);
	t = calc(x/2);
	if( x%2 == 0 )
		return t*t;
	else
		return t*t*BigNum(2);
}


#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <limits>
#include <map>
using namespace std;

const int MAXD=10010;  // ����
const int DIG=9, BASE=1000000000;
const unsigned long long BOUND = numeric_limits<unsigned long long>::max()-(unsigned long long)BASE*BASE;

struct BigNum
{
    int D, digits[MAXD/DIG+2];

    inline void trim ()
    {
        while (D > 1 && digits [D - 1] == 0)
            D--;
    }

    inline void init (long long x)
    {
        memset (digits, 0, sizeof (digits));
        D = 0;

        do
        {
            digits [D++] = x % BASE;
            x /= BASE;
        }
        while (x > 0);
    }

    inline BigNum (long long x)
    {
        init (x);
    }

    inline BigNum (int x = 0)
    {
        init (x);
    }

    inline BigNum (char *s)
    {
        memset (digits, 0, sizeof (digits));
        int len = strlen (s), first = (len + DIG - 1) % DIG + 1;
        D = (len + DIG - 1) / DIG;

        for (int i = 0; i < first; i++)
            digits [D - 1] = digits [D - 1] * 10 + s [i] - '0';

        for (int i = first, d = D - 2; i < len; i += DIG, d--)
            for (int j = i; j < i + DIG; j++)
                digits [d] = digits [d] * 10 + s [j] - '0';

        trim ();
    }

    inline char *str ()
    {
        trim ();
        char *buf = new char [DIG * D + 1];
        int pos = 0, d = digits [D - 1];

        do
        {
            buf [pos++] = d % 10 + '0';
            d /= 10;
        }
        while (d > 0);

        reverse (buf, buf + pos);

        for (int i = D - 2; i >= 0; i--, pos += DIG)
            for (int j = DIG - 1, t = digits [i]; j >= 0; j--)
            {
                buf [pos + j] = t % 10 + '0';
                t /= 10;
            }

        buf [pos] = '\0';
        return buf;
    }

    inline bool operator < (const BigNum &o) const  // ����С��
    {
        if (D != o.D)
            return D < o.D;

        for (int i = D - 1; i >= 0; i--)
            if (digits [i] != o.digits [i])
                return digits [i] < o.digits [i];

        return false;
    }

    inline bool operator == (const BigNum &o) const   // �����
    {
        if (D != o.D)
            return false;

        for (int i = 0; i < D; i++)
            if (digits [i] != o.digits [i])
                return false;

        return true;
    }

    inline BigNum operator << (int p) const  // ��������
    {
        BigNum temp;
        temp.D = D + p;

        for (int i = 0; i < D; i++)
            temp.digits [i + p] = digits [i];

        for (int i = 0; i < p; i++)
            temp.digits [i] = 0;

        return temp;
    }

    inline BigNum operator >> (int p) const  // ��������
    {
        BigNum temp;
        temp.D = D - p;

        for (int i = 0; i < D - p; i++)
            temp.digits [i] = digits [i + p];

        for (int i = D - p; i < D; i++)
            temp.digits [i] = 0;

        return temp;
    }

    inline BigNum range (int a, int b) const
    {
        BigNum temp = 0;
        temp.D = b - a;

        for (int i = 0; i < temp.D; i++)
            temp.digits [i] = digits [i + a];

        return temp;
    }

    inline BigNum operator + (const BigNum &o) const  // �����
    {
        BigNum sum = o;
        int carry = 0;

        for (sum.D = 0; sum.D < D || carry > 0; sum.D++)
        {
            sum.digits [sum.D] += (sum.D < D ? digits [sum.D] : 0) + carry;

            if (sum.digits [sum.D] >= BASE)
            {
                sum.digits [sum.D] -= BASE;
                carry = 1;
            }
            else
                carry = 0;
        }

        sum.D = max (sum.D, o.D);
        sum.trim ();
        return sum;
    }

    inline BigNum operator - (const BigNum &o) const  // �����
    {
        BigNum diff = *this;

        for (int i = 0, carry = 0; i < o.D || carry > 0; i++)
        {
            diff.digits [i] -= (i < o.D ? o.digits [i] : 0) + carry;

            if (diff.digits [i] < 0)
            {
                diff.digits [i] += BASE;
                carry = 1;
            }
            else
                carry = 0;
        }

        diff.trim ();
        return diff;
    }

    inline BigNum operator * (const BigNum &o) const  // �����
    {
        BigNum prod = 0;
        unsigned long long sum = 0, carry = 0;

        for (prod.D = 0; prod.D < D + o.D - 1 || carry > 0; prod.D++)
        {
            sum = carry % BASE;
            carry /= BASE;

            for (int j = max (prod.D - o.D + 1, 0); j <= min (D - 1, prod.D); j++)
            {
                sum += (unsigned long long) digits [j] * o.digits [prod.D - j];

                if (sum >= BOUND)
                {
                    carry += sum / BASE;
                    sum %= BASE;
                }
            }

            carry += sum / BASE;
            prod.digits [prod.D] = sum % BASE;
        }

        prod.trim ();
        return prod;
    }

    inline double double_div (const BigNum &o) const
    {
        double val = 0, oval = 0;
        int num = 0, onum = 0;

        for (int i = D - 1; i >= max (D - 3, 0); i--, num++)
            val = val * BASE + digits [i];

        for (int i = o.D - 1; i >= max (o.D - 3, 0); i--, onum++)
            oval = oval * BASE + o.digits [i];

        return val / oval * (D - num > o.D - onum ? BASE : 1);
    }

    inline pair <BigNum, BigNum> divmod (const BigNum &o) const  // ���ģ
    {
        BigNum quot = 0, rem = *this, temp;

        for (int i = D - o.D; i >= 0; i--)
        {
            temp = rem.range (i, rem.D);
            int div = (int) temp.double_div (o);
            BigNum mult = o * div;

            while (div > 0 && temp < mult)
            {
                mult = mult - o;
                div--;
            }

            while (div + 1 < BASE && !(temp < mult + o))
            {
                mult = mult + o;
                div++;
            }

            rem = rem - (o * div << i);

            if (div > 0)
            {
                quot.digits [i] = div;
                quot.D = max (quot.D, i + 1);
            }
        }

        quot.trim ();
        rem.trim ();
        return make_pair (quot, rem);
    }

    inline BigNum operator / (const BigNum &o) const  // �����
    {
        return divmod (o).first;
    }

    inline BigNum operator % (const BigNum &o) const  // ����ģ
    {
        return divmod (o).second;
    }

    inline BigNum power (int exp) const  // ������
    {
        BigNum p = 1, temp = *this;

        while (exp > 0)
        {
            if (exp & 1) p = p * temp;
            if (exp > 1) temp = temp * temp;
            exp >>= 1;
        }

        return p;
    }
};

typedef pair<string, int> Item;

Item it[5010];
bool used[5010];

BigNum calc(int x);

int main()
{
	int n;
	map< int, int, greater<int> > mp;
	map< int, int, greater<int> >::iterator ptr;

	cin>>n;
	for(int i=0; i<n; i++)
	{
		cin>>it[i].first>>it[i].second;
		if( it[i].first[0] == 's' )
			mp.insert(make_pair(it[i].second, i));
	}

	BigNum ans(0);
	for(ptr=mp.begin(); ptr!=mp.end(); ptr++)
		for(int i=ptr->second; i>=0; i--)
		{
			if( used[i] )
				break;
			if( it[i].first[0]=='w' && it[i].second==ptr->first )
			{
				ans = ans+calc(ptr->first);
				for(int j=i; j<=ptr->second; j++)
					used[j] = 1;
				break;
			}
		}
	printf("%s\n", ans.str());

	return 0;
}

BigNum calc(int x)
{
	BigNum t;

	if( x < 63 )
	{
		long long tmp = 1<<x;
		return BigNum(tmp);
	}
	t = calc(x/2);
	t = t*t;
	if( x%2 == 1 )
		t = t*BigNum(2);

	return t;
}


#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <limits>
#include <map>
using namespace std;

const int MAXD=1010;  // ����
const int DIG=9, BASE=1000000000;
const unsigned long long BOUND = numeric_limits<unsigned long long>::max()-(unsigned long long)BASE*BASE;

struct BigNum
{
    int D, digits[MAXD/DIG+2];

    inline void trim ()
    {
        while (D > 1 && digits [D - 1] == 0)
            D--;
    }

    inline void init (long long x)
    {
        memset (digits, 0, sizeof (digits));
        D = 0;

        do
        {
            digits [D++] = x % BASE;
            x /= BASE;
        }
        while (x > 0);
    }

    inline BigNum (long long x)
    {
        init (x);
    }

    inline BigNum (int x = 0)
    {
        init (x);
    }

    inline BigNum (char *s)
    {
        memset (digits, 0, sizeof (digits));
        int len = strlen (s), first = (len + DIG - 1) % DIG + 1;
        D = (len + DIG - 1) / DIG;

        for (int i = 0; i < first; i++)
            digits [D - 1] = digits [D - 1] * 10 + s [i] - '0';

        for (int i = first, d = D - 2; i < len; i += DIG, d--)
            for (int j = i; j < i + DIG; j++)
                digits [d] = digits [d] * 10 + s [j] - '0';

        trim ();
    }

    inline char *str ()
    {
        trim ();
        char *buf = new char [DIG * D + 1];
        int pos = 0, d = digits [D - 1];

        do
        {
            buf [pos++] = d % 10 + '0';
            d /= 10;
        }
        while (d > 0);

        reverse (buf, buf + pos);

        for (int i = D - 2; i >= 0; i--, pos += DIG)
            for (int j = DIG - 1, t = digits [i]; j >= 0; j--)
            {
                buf [pos + j] = t % 10 + '0';
                t /= 10;
            }

        buf [pos] = '\0';
        return buf;
    }

    inline bool operator < (const BigNum &o) const  // ����С��
    {
        if (D != o.D)
            return D < o.D;

        for (int i = D - 1; i >= 0; i--)
            if (digits [i] != o.digits [i])
                return digits [i] < o.digits [i];

        return false;
    }

    inline bool operator == (const BigNum &o) const   // �����
    {
        if (D != o.D)
            return false;

        for (int i = 0; i < D; i++)
            if (digits [i] != o.digits [i])
                return false;

        return true;
    }

    inline BigNum operator << (int p) const  // ��������
    {
        BigNum temp;
        temp.D = D + p;

        for (int i = 0; i < D; i++)
            temp.digits [i + p] = digits [i];

        for (int i = 0; i < p; i++)
            temp.digits [i] = 0;

        return temp;
    }

    inline BigNum operator >> (int p) const  // ��������
    {
        BigNum temp;
        temp.D = D - p;

        for (int i = 0; i < D - p; i++)
            temp.digits [i] = digits [i + p];

        for (int i = D - p; i < D; i++)
            temp.digits [i] = 0;

        return temp;
    }

    inline BigNum range (int a, int b) const
    {
        BigNum temp = 0;
        temp.D = b - a;

        for (int i = 0; i < temp.D; i++)
            temp.digits [i] = digits [i + a];

        return temp;
    }

    inline BigNum operator + (const BigNum &o) const  // �����
    {
        BigNum sum = o;
        int carry = 0;

        for (sum.D = 0; sum.D < D || carry > 0; sum.D++)
        {
            sum.digits [sum.D] += (sum.D < D ? digits [sum.D] : 0) + carry;

            if (sum.digits [sum.D] >= BASE)
            {
                sum.digits [sum.D] -= BASE;
                carry = 1;
            }
            else
                carry = 0;
        }

        sum.D = max (sum.D, o.D);
        sum.trim ();
        return sum;
    }

    inline BigNum operator - (const BigNum &o) const  // �����
    {
        BigNum diff = *this;

        for (int i = 0, carry = 0; i < o.D || carry > 0; i++)
        {
            diff.digits [i] -= (i < o.D ? o.digits [i] : 0) + carry;

            if (diff.digits [i] < 0)
            {
                diff.digits [i] += BASE;
                carry = 1;
            }
            else
                carry = 0;
        }

        diff.trim ();
        return diff;
    }

    inline BigNum operator * (const BigNum &o) const  // �����
    {
        BigNum prod = 0;
        unsigned long long sum = 0, carry = 0;

        for (prod.D = 0; prod.D < D + o.D - 1 || carry > 0; prod.D++)
        {
            sum = carry % BASE;
            carry /= BASE;

            for (int j = max (prod.D - o.D + 1, 0); j <= min (D - 1, prod.D); j++)
            {
                sum += (unsigned long long) digits [j] * o.digits [prod.D - j];

                if (sum >= BOUND)
                {
                    carry += sum / BASE;
                    sum %= BASE;
                }
            }

            carry += sum / BASE;
            prod.digits [prod.D] = sum % BASE;
        }

        prod.trim ();
        return prod;
    }

    inline double double_div (const BigNum &o) const
    {
        double val = 0, oval = 0;
        int num = 0, onum = 0;

        for (int i = D - 1; i >= max (D - 3, 0); i--, num++)
            val = val * BASE + digits [i];

        for (int i = o.D - 1; i >= max (o.D - 3, 0); i--, onum++)
            oval = oval * BASE + o.digits [i];

        return val / oval * (D - num > o.D - onum ? BASE : 1);
    }

    inline pair <BigNum, BigNum> divmod (const BigNum &o) const  // ���ģ
    {
        BigNum quot = 0, rem = *this, temp;

        for (int i = D - o.D; i >= 0; i--)
        {
            temp = rem.range (i, rem.D);
            int div = (int) temp.double_div (o);
            BigNum mult = o * div;

            while (div > 0 && temp < mult)
            {
                mult = mult - o;
                div--;
            }

            while (div + 1 < BASE && !(temp < mult + o))
            {
                mult = mult + o;
                div++;
            }

            rem = rem - (o * div << i);

            if (div > 0)
            {
                quot.digits [i] = div;
                quot.D = max (quot.D, i + 1);
            }
        }

        quot.trim ();
        rem.trim ();
        return make_pair (quot, rem);
    }

    inline BigNum operator / (const BigNum &o) const  // �����
    {
        return divmod (o).first;
    }

    inline BigNum operator % (const BigNum &o) const  // ����ģ
    {
        return divmod (o).second;
    }

    inline BigNum power (int exp) const  // ������
    {
        BigNum p = 1, temp = *this;

        while (exp > 0)
        {
            if (exp & 1) p = p * temp;
            if (exp > 1) temp = temp * temp;
            exp >>= 1;
        }

        return p;
    }
};

typedef pair<string, int> Item;

Item it[5010];
bool used[5010];
bool exist[2010];

BigNum calc(int x);

int main()
{
	string str;
	int n;
	map< int, int, greater<int> > mp;
	map< int, int, greater<int> >::iterator ptr;

	cin>>n;
	for(int i=0; i<n; i++)
	{
		cin>>it[i].first>>it[i].second;
		if( it[i].first[0] == 's' )
			mp.insert(make_pair(it[i].second, i));
		if( it[i].first[0] == 'w' )
			exist[it[i].second] = 1;
	}

	BigNum ans(0);
	for(ptr=mp.begin(); ptr!=mp.end(); ptr++)
	{
		if( used[ptr->second] || !exist[ptr->first] )
			continue;
		for(int i=ptr->second; i>=0; i--)
		{
			if( used[i] )
				break;
			used[i] = 1;
			if( it[i].first[0]=='w' && it[i].second==ptr->first )
			{
				ans = ans+calc(ptr->first);
				break;
			}
		}
	}
	printf("%s\n", ans.str());

	return 0;
}

BigNum calc(int x)
{
	BigNum t;

	if( x < 63 )
		return BigNum(1<<x);
	t = calc(x/2);
	if( x%2 == 0 )
		return t*t;
	else
		return t*t*BigNum(2);
}


#include <iostream>
#include <string>
#include <vector>
#include <cstring>
#include <algorithm>
#include <limits>
#include <map>
using namespace std;

const int MAXD=1010;  // ����
const int DIG=9, BASE=1000000000;
const unsigned long long BOUND = numeric_limits<unsigned long long>::max()-(unsigned long long)BASE*BASE;

struct BigNum
{
    int D, digits[MAXD/DIG+2];

    inline void trim ()
    {
        while (D > 1 && digits [D - 1] == 0)
            D--;
    }

    inline void init (long long x)
    {
        memset (digits, 0, sizeof (digits));
        D = 0;

        do
        {
            digits [D++] = x % BASE;
            x /= BASE;
        }
        while (x > 0);
    }

    inline BigNum (long long x)
    {
        init (x);
    }

    inline BigNum (int x = 0)
    {
        init (x);
    }

    inline BigNum (char *s)
    {
        memset (digits, 0, sizeof (digits));
        int len = strlen (s), first = (len + DIG - 1) % DIG + 1;
        D = (len + DIG - 1) / DIG;

        for (int i = 0; i < first; i++)
            digits [D - 1] = digits [D - 1] * 10 + s [i] - '0';

        for (int i = first, d = D - 2; i < len; i += DIG, d--)
            for (int j = i; j < i + DIG; j++)
                digits [d] = digits [d] * 10 + s [j] - '0';

        trim ();
    }

    inline char *str ()
    {
        trim ();
        char *buf = new char [DIG * D + 1];
        int pos = 0, d = digits [D - 1];

        do
        {
            buf [pos++] = d % 10 + '0';
            d /= 10;
        }
        while (d > 0);

        reverse (buf, buf + pos);

        for (int i = D - 2; i >= 0; i--, pos += DIG)
            for (int j = DIG - 1, t = digits [i]; j >= 0; j--)
            {
                buf [pos + j] = t % 10 + '0';
                t /= 10;
            }

        buf [pos] = '\0';
        return buf;
    }

    inline bool operator < (const BigNum &o) const  // ����С��
    {
        if (D != o.D)
            return D < o.D;

        for (int i = D - 1; i >= 0; i--)
            if (digits [i] != o.digits [i])
                return digits [i] < o.digits [i];

        return false;
    }

    inline bool operator == (const BigNum &o) const   // �����
    {
        if (D != o.D)
            return false;

        for (int i = 0; i < D; i++)
            if (digits [i] != o.digits [i])
                return false;

        return true;
    }

    inline BigNum operator << (int p) const  // ��������
    {
        BigNum temp;
        temp.D = D + p;

        for (int i = 0; i < D; i++)
            temp.digits [i + p] = digits [i];

        for (int i = 0; i < p; i++)
            temp.digits [i] = 0;

        return temp;
    }

    inline BigNum operator >> (int p) const  // ��������
    {
        BigNum temp;
        temp.D = D - p;

        for (int i = 0; i < D - p; i++)
            temp.digits [i] = digits [i + p];

        for (int i = D - p; i < D; i++)
            temp.digits [i] = 0;

        return temp;
    }

    inline BigNum range (int a, int b) const
    {
        BigNum temp = 0;
        temp.D = b - a;

        for (int i = 0; i < temp.D; i++)
            temp.digits [i] = digits [i + a];

        return temp;
    }

    inline BigNum operator + (const BigNum &o) const  // �����
    {
        BigNum sum = o;
        int carry = 0;

        for (sum.D = 0; sum.D < D || carry > 0; sum.D++)
        {
            sum.digits [sum.D] += (sum.D < D ? digits [sum.D] : 0) + carry;

            if (sum.digits [sum.D] >= BASE)
            {
                sum.digits [sum.D] -= BASE;
                carry = 1;
            }
            else
                carry = 0;
        }

        sum.D = max (sum.D, o.D);
        sum.trim ();
        return sum;
    }

    inline BigNum operator - (const BigNum &o) const  // �����
    {
        BigNum diff = *this;

        for (int i = 0, carry = 0; i < o.D || carry > 0; i++)
        {
            diff.digits [i] -= (i < o.D ? o.digits [i] : 0) + carry;

            if (diff.digits [i] < 0)
            {
                diff.digits [i] += BASE;
                carry = 1;
            }
            else
                carry = 0;
        }

        diff.trim ();
        return diff;
    }

    inline BigNum operator * (const BigNum &o) const  // �����
    {
        BigNum prod = 0;
        unsigned long long sum = 0, carry = 0;

        for (prod.D = 0; prod.D < D + o.D - 1 || carry > 0; prod.D++)
        {
            sum = carry % BASE;
            carry /= BASE;

            for (int j = max (prod.D - o.D + 1, 0); j <= min (D - 1, prod.D); j++)
            {
                sum += (unsigned long long) digits [j] * o.digits [prod.D - j];

                if (sum >= BOUND)
                {
                    carry += sum / BASE;
                    sum %= BASE;
                }
            }

            carry += sum / BASE;
            prod.digits [prod.D] = sum % BASE;
        }

        prod.trim ();
        return prod;
    }

    inline double double_div (const BigNum &o) const
    {
        double val = 0, oval = 0;
        int num = 0, onum = 0;

        for (int i = D - 1; i >= max (D - 3, 0); i--, num++)
            val = val * BASE + digits [i];

        for (int i = o.D - 1; i >= max (o.D - 3, 0); i--, onum++)
            oval = oval * BASE + o.digits [i];

        return val / oval * (D - num > o.D - onum ? BASE : 1);
    }

    inline pair <BigNum, BigNum> divmod (const BigNum &o) const  // ���ģ
    {
        BigNum quot = 0, rem = *this, temp;

        for (int i = D - o.D; i >= 0; i--)
        {
            temp = rem.range (i, rem.D);
            int div = (int) temp.double_div (o);
            BigNum mult = o * div;

            while (div > 0 && temp < mult)
            {
                mult = mult - o;
                div--;
            }

            while (div + 1 < BASE && !(temp < mult + o))
            {
                mult = mult + o;
                div++;
            }

            rem = rem - (o * div << i);

            if (div > 0)
            {
                quot.digits [i] = div;
                quot.D = max (quot.D, i + 1);
            }
        }

        quot.trim ();
        rem.trim ();
        return make_pair (quot, rem);
    }

    inline BigNum operator / (const BigNum &o) const  // �����
    {
        return divmod (o).first;
    }

    inline BigNum operator % (const BigNum &o) const  // ����ģ
    {
        return divmod (o).second;
    }

    inline BigNum power (int exp) const  // ������
    {
        BigNum p = 1, temp = *this;

        while (exp > 0)
        {
            if (exp & 1) p = p * temp;
            if (exp > 1) temp = temp * temp;
            exp >>= 1;
        }

        return p;
    }
};

typedef pair<string, int> Item;

Item it[5000];
bool used[5000];
bool exist[2010];

BigNum calc(int x);

int main()
{
	string str;
	int current=-1, n;
	vector<int> res;
	map< int, int, greater<int> > mp;
	map< int, int, greater<int> >::iterator ptr;

	cin>>n;
	for(int i=0; i<n; i++)
	{
		cin>>it[i].first>>it[i].second;
		if( it[i].first[0] == 's' )
		{
			exist[it[i].second] = 1;
			mp.insert(make_pair(it[i].second, i));
		}
	}

	BigNum ans(0);
	for(ptr=mp.begin(); ptr!=mp.end(); ptr++)
	{
		if( used[ptr->second] || !exist[ptr->first] )
			continue;
		for(int i=ptr->second; i>=0; i--)
		{
			if( used[i] )
				break;
			used[i] = 1;
			if( it[i].first[0]=='w' && it[i].second==ptr->first )
			{
				ans = ans+calc(ptr->first);
				break;
			}
		}
	}
	printf("%s\n", ans.str());

	return 0;
}

BigNum calc(int x)
{
	BigNum t;

	if( x < 63 )
		return BigNum(1<<x);
	t = calc(x/2);
	if( x%2 == 0 )
		return t*t;
	else
		return t*t*BigNum(2);
}


#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <limits>
#include <map>
using namespace std;

const int MAXD=10010;  // ����
const int DIG=9, BASE=1000000000;
const unsigned long long BOUND = numeric_limits<unsigned long long>::max()-(unsigned long long)BASE*BASE;

struct BigNum
{
    int D, digits[MAXD/DIG+2];

    inline void trim ()
    {
        while (D > 1 && digits [D - 1] == 0)
            D--;
    }

    inline void init (long long x)
    {
        memset (digits, 0, sizeof (digits));
        D = 0;

        do
        {
            digits [D++] = x % BASE;
            x /= BASE;
        }
        while (x > 0);
    }

    inline BigNum (long long x)
    {
        init (x);
    }

    inline BigNum (int x = 0)
    {
        init (x);
    }

    inline BigNum (char *s)
    {
        memset (digits, 0, sizeof (digits));
        int len = strlen (s), first = (len + DIG - 1) % DIG + 1;
        D = (len + DIG - 1) / DIG;

        for (int i = 0; i < first; i++)
            digits [D - 1] = digits [D - 1] * 10 + s [i] - '0';

        for (int i = first, d = D - 2; i < len; i += DIG, d--)
            for (int j = i; j < i + DIG; j++)
                digits [d] = digits [d] * 10 + s [j] - '0';

        trim ();
    }

    inline char *str ()
    {
        trim ();
        char *buf = new char [DIG * D + 1];
        int pos = 0, d = digits [D - 1];

        do
        {
            buf [pos++] = d % 10 + '0';
            d /= 10;
        }
        while (d > 0);

        reverse (buf, buf + pos);

        for (int i = D - 2; i >= 0; i--, pos += DIG)
            for (int j = DIG - 1, t = digits [i]; j >= 0; j--)
            {
                buf [pos + j] = t % 10 + '0';
                t /= 10;
            }

        buf [pos] = '\0';
        return buf;
    }

    inline bool operator < (const BigNum &o) const  // ����С��
    {
        if (D != o.D)
            return D < o.D;

        for (int i = D - 1; i >= 0; i--)
            if (digits [i] != o.digits [i])
                return digits [i] < o.digits [i];

        return false;
    }

    inline bool operator == (const BigNum &o) const   // �����
    {
        if (D != o.D)
            return false;

        for (int i = 0; i < D; i++)
            if (digits [i] != o.digits [i])
                return false;

        return true;
    }

    inline BigNum operator << (int p) const  // ��������
    {
        BigNum temp;
        temp.D = D + p;

        for (int i = 0; i < D; i++)
            temp.digits [i + p] = digits [i];

        for (int i = 0; i < p; i++)
            temp.digits [i] = 0;

        return temp;
    }

    inline BigNum operator >> (int p) const  // ��������
    {
        BigNum temp;
        temp.D = D - p;

        for (int i = 0; i < D - p; i++)
            temp.digits [i] = digits [i + p];

        for (int i = D - p; i < D; i++)
            temp.digits [i] = 0;

        return temp;
    }

    inline BigNum range (int a, int b) const
    {
        BigNum temp = 0;
        temp.D = b - a;

        for (int i = 0; i < temp.D; i++)
            temp.digits [i] = digits [i + a];

        return temp;
    }

    inline BigNum operator + (const BigNum &o) const  // �����
    {
        BigNum sum = o;
        int carry = 0;

        for (sum.D = 0; sum.D < D || carry > 0; sum.D++)
        {
            sum.digits [sum.D] += (sum.D < D ? digits [sum.D] : 0) + carry;

            if (sum.digits [sum.D] >= BASE)
            {
                sum.digits [sum.D] -= BASE;
                carry = 1;
            }
            else
                carry = 0;
        }

        sum.D = max (sum.D, o.D);
        sum.trim ();
        return sum;
    }

    inline BigNum operator - (const BigNum &o) const  // �����
    {
        BigNum diff = *this;

        for (int i = 0, carry = 0; i < o.D || carry > 0; i++)
        {
            diff.digits [i] -= (i < o.D ? o.digits [i] : 0) + carry;

            if (diff.digits [i] < 0)
            {
                diff.digits [i] += BASE;
                carry = 1;
            }
            else
                carry = 0;
        }

        diff.trim ();
        return diff;
    }

    inline BigNum operator * (const BigNum &o) const  // �����
    {
        BigNum prod = 0;
        unsigned long long sum = 0, carry = 0;

        for (prod.D = 0; prod.D < D + o.D - 1 || carry > 0; prod.D++)
        {
            sum = carry % BASE;
            carry /= BASE;

            for (int j = max (prod.D - o.D + 1, 0); j <= min (D - 1, prod.D); j++)
            {
                sum += (unsigned long long) digits [j] * o.digits [prod.D - j];

                if (sum >= BOUND)
                {
                    carry += sum / BASE;
                    sum %= BASE;
                }
            }

            carry += sum / BASE;
            prod.digits [prod.D] = sum % BASE;
        }

        prod.trim ();
        return prod;
    }

    inline double double_div (const BigNum &o) const
    {
        double val = 0, oval = 0;
        int num = 0, onum = 0;

        for (int i = D - 1; i >= max (D - 3, 0); i--, num++)
            val = val * BASE + digits [i];

        for (int i = o.D - 1; i >= max (o.D - 3, 0); i--, onum++)
            oval = oval * BASE + o.digits [i];

        return val / oval * (D - num > o.D - onum ? BASE : 1);
    }

    inline pair <BigNum, BigNum> divmod (const BigNum &o) const  // ���ģ
    {
        BigNum quot = 0, rem = *this, temp;

        for (int i = D - o.D; i >= 0; i--)
        {
            temp = rem.range (i, rem.D);
            int div = (int) temp.double_div (o);
            BigNum mult = o * div;

            while (div > 0 && temp < mult)
            {
                mult = mult - o;
                div--;
            }

            while (div + 1 < BASE && !(temp < mult + o))
            {
                mult = mult + o;
                div++;
            }

            rem = rem - (o * div << i);

            if (div > 0)
            {
                quot.digits [i] = div;
                quot.D = max (quot.D, i + 1);
            }
        }

        quot.trim ();
        rem.trim ();
        return make_pair (quot, rem);
    }

    inline BigNum operator / (const BigNum &o) const  // �����
    {
        return divmod (o).first;
    }

    inline BigNum operator % (const BigNum &o) const  // ����ģ
    {
        return divmod (o).second;
    }

    inline BigNum power (int exp) const  // ������
    {
        BigNum p = 1, temp = *this;

        while (exp > 0)
        {
            if (exp & 1) p = p * temp;
            if (exp > 1) temp = temp * temp;
            exp >>= 1;
        }

        return p;
    }
};

typedef pair<string, int> Item;

Item it[5010];
bool used[5010];

BigNum calc(int x);

int main()
{
	int n;
	string str;
	map< int, int, greater<int> > mp;
	map< int, int, greater<int> >::iterator ptr;

	cin>>n;
	for(int i=0; i<n; i++)
	{
		cin>>it[i].first>>it[i].second;
		if( it[i].first[0] == 's' )
			mp.insert(make_pair(it[i].second, i));
	}

	BigNum ans(0);
	for(ptr=mp.begin(); ptr!=mp.end(); ptr++)
		for(int i=ptr->second; i>=0; i--)
		{
			if( used[i] )
				break;
			if( it[i].first[0]=='w' && it[i].second==ptr->first )
			{
				ans = ans+calc(ptr->first);
				for(int j=i; j<=ptr->second; j++)
					used[j] = 1;
				break;
			}
		}
	printf("%s\n", ans.str());

	return 0;
}

BigNum calc(int x)
{
	BigNum t;

	if( x < 63 )
		return BigNum(long long(1<<x));
	t = calc(x/2);
	if( x%2 == 0 )
		return t*t;
	else
		return t*t*BigNum(2);
}


#include <cstdio>
#include <cstring>

#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;

string dp[5010];
int win[2010];
int n;

string pow2[2010];

void multi2( string &ress , const string &p ){

	int flag = 0;
	ress = "";
	for( int i = 0 ; i < p.size() ; i ++ ){
		ress += ( ( p[i] - '0' ) * 2 + flag ) % 10 + '0';
		flag = ( ( p[i] - '0' ) * 2 + flag ) / 10;
	}

	if( flag )
		ress += '1';

	int pos = ress.size() - 1;
	for( ; pos >= 0 && ress[pos] == '0' ; pos -- );
	ress = ress.substr( 0 , pos + 1 );

	if( ress == "" )
		ress = "0";

	return;
}
void add( string &ress , string num ){

	while( ress.size() < num.size() )
		ress += '0';

	while( num.size() < ress.size() )
		num += '0';

	int flag = 0;
	for( int i = 0 ; i < ress.size() ; i ++ ){
		char tRes = ( ress[i] - '0' + num[i] - '0' + flag ) % 10 + '0';
		flag = ( ress[i] - '0' + num[i] - '0' + flag ) / 10;

		ress[i] = tRes;

	}

	if( flag )
		ress += '1';

	int pos = ress.size() - 1;
	for( ; pos >= 0 && ress[pos] == '0' ; pos -- );
	ress = ress.substr( 0 , pos + 1 );

	if( ress == "" )
		ress = "0";

	return;
}
void initPow2( void ){

	pow2[0] = "1";
	for( int i = 1; i <= 2000 ; i ++ )
		multi2( pow2[i] , pow2[i-1] );
	return;
}

bool larger( const string &str1 , const string &str2 ){

	if( str1.size() > str2.size() )
		return true;

	if( str1.size() < str2.size() )
		return false;

	for( int i = str1.size() - 1 ; i >= 0 ; i -- )
		if( str1[i] > str2[i] )
			return true;

	return false;
}

int main( void ){

	char enter;
	char input[10];
	int t;

	dp[0] = "0";
	initPow2();
	memset( win , -1 ,sizeof( win ) );

	scanf("%d%c",&n,&enter);
	for( int i = 1 ; i <= n ; i ++ ){
		scanf("%s%c%d%c",input,&enter,&t,&enter);

		if( input[0] == 'w' ){
			win[ t ] = i;
			dp[i] = dp[i-1];
		}
		else{

			if( win[t] != -1 ){
				string temp = pow2[ t ];
				add( temp , dp[ win[t] ] );

				if( larger( temp , dp[i-1] ) )
					dp[i] = temp;
				else
					dp[i] = dp[i-1];
			}
			else
				dp[i] = dp[i-1];
		}
	}

	reverse( dp[n].begin() , dp[n].end() );
	printf("%s\n",dp[n].c_str());

	//system("pause");

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <stack>
#include <string>
#include <algorithm>
#include <map>
#include <fstream>
#include <queue>
#include <cmath>
using namespace std;
#include <vector>
#include <string>
#include <list>
#include <map>
#include <utility>
#include <cmath>
#include <algorithm>
#include <sstream>
#include<iostream>
using namespace std;
int T;
int N;

#define MAXN 9999
#define DLEN 4
int const MaxBits = 900 * 4;
int const Bits = 4;
int const MaxLen = MaxBits / Bits + 1;
int const MaxSingle = 10000;

struct BigInt
{
	int Dig[MaxLen];
	int Digs;
	//void operator = (int n);
	void operator = (char *s);
	void operator = (long long n);
	void Print();
};

void BigInt::Print()
{
	printf("%d",Dig[Digs-1]);
	for(int i = Digs-2,tmp; i >= 0; i--)
	{
		tmp = MaxSingle / 10;
		while(tmp > 1)
		{
			if(Dig[i] < tmp)
				printf("0");
			else
				break;
			tmp /= 10;
		}
		printf("%d",Dig[i]);
	}
}

void BigInt::operator = (long long n)
{
	Digs = 0;
	while(n > 0)
	{
		Dig[Digs++] = n % MaxSingle;
		n /= MaxSingle;
	}
	for(int i = Digs; i < MaxLen; i++)
		Dig[i] = 0;
}

void BigInt::operator = (char *StrNum)
{
	int len = strlen(StrNum), tmp;
	Digs = 0;
	for( ; len >= Bits; len -= Bits)
	{
		tmp = 0;
		for(int i = len - Bits; i < len; i++)
			tmp *= 10, tmp += StrNum[i] - '0';
		Dig[Digs++] = tmp;
	}
	if(len == 0)
		return;
	tmp = 0;
	for(int i = 0; i < len; i++)
		tmp *= 10, tmp += StrNum[i] - '0';
	Dig[Digs++] = tmp;
	for(int i = Digs; i < MaxLen; i++)
		Dig[i] = 0;
}

BigInt operator + (BigInt const &a, BigInt const &b)
{
	BigInt c = a;
	int carry(0);
	c.Digs = c.Digs < b.Digs ? b.Digs : c.Digs;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] += b.Dig[i] + carry;
		if(c.Dig[i] >= MaxSingle)
			c.Dig[i] -= MaxSingle, carry = 1;
		else
			carry = 0;
	}
	if(carry > 0)
		c.Dig[c.Digs++] = carry;
	return c;
}

BigInt operator - (BigInt const &a, BigInt const &b)
{   // assume that a > b,  a and b are positive
	BigInt c = a;
	int dec = 0;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] -= b.Dig[i] + dec;
		if(c.Dig[i] < 0)
			c.Dig[i] += MaxSingle, dec = 1;
		else
			dec = 0;
	}
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator * (BigInt const &a, BigInt const &b)
{
	BigInt c;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = 0;
	int carry;
	for(int i = 0; i < a.Digs; i++)
	{
		carry = 0;
		for(int j = 0; j < b.Digs; j++)
		{
			c.Dig[i+j] += a.Dig[i] * b.Dig[j] + carry;
			carry = c.Dig[i+j] / MaxSingle;
			c.Dig[i+j] -= carry * MaxSingle;
		}
		if(carry != 0)
			c.Dig[i+b.Digs] += carry;
	}
	c.Digs = a.Digs + b.Digs;
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator * (BigInt const &a, int const &b)
{
	BigInt c = a;
	for(int i = 0; i < c.Digs; i++)
		c.Dig[i] *= b;
	int carry = 0;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] += carry;
		carry = c.Dig[i] / MaxSingle;
		c.Dig[i] -= carry * MaxSingle;
	}
	while(carry > 0)
		c.Dig[c.Digs++] = carry % MaxSingle, carry /= MaxSingle;
	return c;
}

BigInt operator + (BigInt const &a, int const &b)
{
	BigInt c = a;
	int carry = b;
	for(int i = 0; carry > 0; i++)
	{
		c.Dig[i] += carry;
		carry = c.Dig[i] / MaxSingle;
		c.Dig[i] -= carry * MaxSingle;
		if(i == c.Digs)
			c.Digs++;
	}
	return c;
}

bool operator < (BigInt const &a, BigInt const &b)
{
	if(a.Digs == b.Digs)
		for(int i = a.Digs - 1; i >= 0; i--)
			if(a.Dig[i] != b.Dig[i])
				return a.Dig[i] < b.Dig[i];
	return a.Digs < b.Digs;
}

bool operator == (BigInt const &a, BigInt const &b)
{
	if(a.Digs != b.Digs)
		return false;
	for(int i = 0; i < a.Digs; i++)
		if(a.Dig[i] != b.Dig[i])
			return false;
	return true;
}

BigInt operator / (BigInt const &a, BigInt const &b)
{
	BigInt c,t,m;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = t.Dig[i] = 0;
	t.Digs = 1;
	for(int i = a.Digs - 1; i >= 0; i--)
	{
		t = t * MaxSingle;
		t = t + a.Dig[i];
		int left = 0, right = MaxSingle, mid;
		while(left < right - 1)
		{
			mid = ((left + right)>> 1);
			m = b * mid;
			if(m < t) // m >= t
				left = mid;
			else
				if(m == t)
					left = right = mid;   // exit
				else
					right = mid;
		}
		m = b * left;
		c.Dig[i] = left;
		t = t - m;
	}
	c.Digs = a.Digs;
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator % (BigInt const &a, BigInt const &b)
{
	return a - (a / b) * b;
}

BigInt pow(BigInt const &a, int n)
{
	BigInt c,t;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = 0;
	c.Dig[0] = 1;
	c.Digs = 1;
	t = a;
	while(n > 0)
	{
		if(n & 1)
			c = c * t;
		t = t * t;
		n = (n>>1);
	}
	return c;
}

typedef struct
{
	bool isSell;
	int x;
}MSticks;

vector<int> res;
int n;
MSticks allMS[5010];

bool isVisit[5010];
BigInt dp[5010];

int main()
{
	freopen("..\\case.in","r",stdin);
	scanf("%d", &n);
	string t_s;
	int x;
	int num_s = 0;
	for(int i = 0;i < n;i++)
	{
		cin>>t_s>>allMS[i].x;
		if(t_s == "win")
			allMS[i].isSell = false;
		else
			allMS[i].isSell = true;
	}

	BigInt num2;
	num2 = "2";

	dp[0] = "0";

	for(int i = 1;i < n;i++)
	{
		dp[i] = dp[i - 1];
		for(int j = i - 1;j >= 0;j--)
		{
			if(allMS[i].isSell && !allMS[j].isSell && allMS[i].x == allMS[j].x)
			{
				if(dp[i] < (dp[j] +  pow(num2, allMS[j].x)))
				{
					dp[i] = dp[j] +  pow(num2, allMS[j].x);
				}
			}
		}
	}

	dp[n - 1].Print();
	printf("\n");
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <stack>
#include <string>
#include <algorithm>
#include <map>
#include <fstream>
#include <queue>
#include <cmath>
using namespace std;
#include <vector>
#include <string>
#include <list>
#include <map>
#include <utility>
#include <cmath>
#include <algorithm>
#include <sstream>
#include<iostream>
using namespace std;
int T;
int N;

#define MAXN 9999
#define DLEN 4
int const MaxBits = 900 * 4;
int const Bits = 4;
int const MaxLen = MaxBits / Bits + 1;
int const MaxSingle = 10000;

struct BigInt
{
	int Dig[MaxLen];
	int Digs;
	// void operator = (int n);
	void operator = (char *s);
	void operator = (long long n);
	void Print();
};

void BigInt::Print()
{
	printf("%d",Dig[Digs-1]);
	for(int i = Digs-2,tmp; i >= 0; i--)
	{
		tmp = MaxSingle / 10;
		while(tmp > 1)
		{
			if(Dig[i] < tmp)
				printf("0");
			else
				break;
			tmp /= 10;
		}
		printf("%d",Dig[i]);
	}
}

void BigInt::operator = (long long n)
{
	Digs = 0;
	while(n > 0)
	{
		Dig[Digs++] = n % MaxSingle;
		n /= MaxSingle;
	}
	for(int i = Digs; i < MaxLen; i++)
		Dig[i] = 0;
}

void BigInt::operator = (char *StrNum)
{
	int len = strlen(StrNum), tmp;
	Digs = 0;
	for( ; len >= Bits; len -= Bits)
	{
		tmp = 0;
		for(int i = len - Bits; i < len; i++)
			tmp *= 10, tmp += StrNum[i] - '0';
		Dig[Digs++] = tmp;
	}
	if(len == 0)
		return;
	tmp = 0;
	for(int i = 0; i < len; i++)
		tmp *= 10, tmp += StrNum[i] - '0';
	Dig[Digs++] = tmp;
	for(int i = Digs; i < MaxLen; i++)
		Dig[i] = 0;
}

BigInt operator + (BigInt const &a, BigInt const &b)
{
	BigInt c = a;
	int carry(0);
	c.Digs = c.Digs> b.Digs ? b.Digs : c.Digs;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] += b.Dig[i] + carry;
		if(c.Dig[i] >= MaxSingle)
			c.Dig[i] -= MaxSingle, carry = 1;
		else
			carry = 0;
	}
	if(carry > 0)
		c.Dig[c.Digs++] = carry;
	return c;
}

BigInt operator - (BigInt const &a, BigInt const &b)
{   // assume that a > b,  a and b are positive
	BigInt c = a;
	int dec = 0;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] -= b.Dig[i] + dec;
		if(c.Dig[i] < 0)
			c.Dig[i] += MaxSingle, dec = 1;
		else
			dec = 0;
	}
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator * (BigInt const &a, BigInt const &b)
{
	BigInt c;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = 0;
	int carry;
	for(int i = 0; i < a.Digs; i++)
	{
		carry = 0;
		for(int j = 0; j < b.Digs; j++)
		{
			c.Dig[i+j] += a.Dig[i] * b.Dig[j] + carry;
			carry = c.Dig[i+j] / MaxSingle;
			c.Dig[i+j] -= carry * MaxSingle;
		}
		if(carry != 0)
			c.Dig[i+b.Digs] += carry;
	}
	c.Digs = a.Digs + b.Digs;
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator * (BigInt const &a, int const &b)
{
	BigInt c = a;
	for(int i = 0; i < c.Digs; i++)
		c.Dig[i] *= b;
	int carry = 0;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] += carry;
		carry = c.Dig[i] / MaxSingle;
		c.Dig[i] -= carry * MaxSingle;
	}
	while(carry > 0)
		c.Dig[c.Digs++] = carry % MaxSingle, carry /= MaxSingle;
	return c;
}

BigInt operator + (BigInt const &a, int const &b)
{
	BigInt c = a;
	int carry = b;
	for(int i = 0; carry > 0; i++)
	{
		c.Dig[i] += carry;
		carry = c.Dig[i] / MaxSingle;
		c.Dig[i] -= carry * MaxSingle;
		if(i == c.Digs)
			c.Digs++;
	}
	return c;
}

bool operator < (BigInt const &a, BigInt const &b)
{
	if(a.Digs == b.Digs)
		for(int i = a.Digs - 1; i >= 0; i--)
			if(a.Dig[i] != b.Dig[i])
				return a.Dig[i] < b.Dig[i];
	return a.Digs < b.Digs;
}

bool operator == (BigInt const &a, BigInt const &b)
{
	if(a.Digs != b.Digs)
		return false;
	for(int i = 0; i < a.Digs; i++)
		if(a.Dig[i] != b.Dig[i])
			return false;
	return true;
}

BigInt operator / (BigInt const &a, BigInt const &b)
{
	BigInt c,t,m;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = t.Dig[i] = 0;
	t.Digs = 1;
	for(int i = a.Digs - 1; i >= 0; i--)
	{
		t = t * MaxSingle;
		t = t + a.Dig[i];
		int left = 0, right = MaxSingle, mid;
		while(left < right - 1)
		{
			mid = ((left + right)>> 1);
			m = b * mid;
			if(m < t) // m >= t
				left = mid;
			else
				if(m == t)
					left = right = mid;   // exit
				else
					right = mid;
		}
		m = b * left;
		c.Dig[i] = left;
		t = t - m;
	}
	c.Digs = a.Digs;
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator % (BigInt const &a, BigInt const &b)
{
	return a - (a / b) * b;
}

BigInt pow(BigInt const &a, int n)
{
	BigInt c,t;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = 0;
	c.Dig[0] = 1;
	c.Digs = 1;
	t = a;
	while(n > 0)
	{
		if(n & 1)
			c = c * t;
		t = t * t;
		n = (n>>1);
	}
	return c;
}
typedef struct
{
	bool isSell;
	int x;
}MSticks;

vector<int> res;
int n;
MSticks allMS[5010];

bool isVisit[5010];
BigInt dp[5010];

int main()
{
	//freopen("..\\case.in","r",stdin);
	scanf("%d", &n);
	string t_s;
	int x;
	int num_s = 0;
	for(int i = 0;i < n;i++)
	{
		cin>>t_s>>allMS[i].x;
		if(t_s == "win")
			allMS[i].isSell = false;
		else
		{
			allMS[i].isSell = true;
		}
	}
	dp[0] = 1ll;
	dp[0] = dp[0] - dp[0];
	BigInt num2;
	num2 = 2ll;
	for(int i = 1;i < n;i++)
	{
		dp[i] = dp[i - 1];
		for(int j = i - 1;j >= 0;j--)
		{
			if(allMS[i].isSell && !allMS[j].isSell && allMS[i].x == allMS[j].x)
			{
				if(dp[i] < (dp[j] + pow(num2, allMS[j].x)))
				{
					dp[i] = dp[j] + pow(num2, allMS[j].x);
				}
			}
		}
	}

	dp[n - 1].Print();
	printf("\n");
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <stack>
#include <string>
#include <algorithm>
#include <map>
#include <fstream>
#include <queue>
#include <cmath>
using namespace std;
#include <vector>
#include <string>
#include <list>
#include <map>
#include <utility>
#include <cmath>
#include <algorithm>
#include <sstream>
#include<iostream>
using namespace std;
int T;
int N;

#define MAXN 9999
#define DLEN 4
int const MaxBits = 900 * 4;
int const Bits = 4;
int const MaxLen = MaxBits / Bits + 1;
int const MaxSingle = 10000;

struct BigInt
{
	int Dig[MaxLen];
	int Digs;
	// void operator = (int n);
	void operator = (char *s);
	void operator = (long long n);
	void Print();
};

void BigInt::Print()
{
	printf("%d",Dig[Digs-1]);
	for(int i = Digs-2,tmp; i >= 0; i--)
	{
		tmp = MaxSingle / 10;
		while(tmp > 1)
		{
			if(Dig[i] < tmp)
				printf("0");
			else
				break;
			tmp /= 10;
		}
		printf("%d",Dig[i]);
	}
}

void BigInt::operator = (long long n)
{
	Digs = 0;
	while(n > 0)
	{
		Dig[Digs++] = n % MaxSingle;
		n /= MaxSingle;
	}
	for(int i = Digs; i < MaxLen; i++)
		Dig[i] = 0;
}

void BigInt::operator = (char *StrNum)
{
	int len = strlen(StrNum), tmp;
	Digs = 0;
	for( ; len >= Bits; len -= Bits)
	{
		tmp = 0;
		for(int i = len - Bits; i < len; i++)
			tmp *= 10, tmp += StrNum[i] - '0';
		Dig[Digs++] = tmp;
	}
	if(len == 0)
		return;
	tmp = 0;
	for(int i = 0; i < len; i++)
		tmp *= 10, tmp += StrNum[i] - '0';
	Dig[Digs++] = tmp;
	for(int i = Digs; i < MaxLen; i++)
		Dig[i] = 0;
}

BigInt operator + (BigInt const &a, BigInt const &b)
{
	BigInt c = a;
	int carry(0);
	c.Digs = c.Digs> b.Digs ? b.Digs : c.Digs;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] += b.Dig[i] + carry;
		if(c.Dig[i] >= MaxSingle)
			c.Dig[i] -= MaxSingle, carry = 1;
		else
			carry = 0;
	}
	if(carry > 0)
		c.Dig[c.Digs++] = carry;
	return c;
}

BigInt operator - (BigInt const &a, BigInt const &b)
{   // assume that a > b,  a and b are positive
	BigInt c = a;
	int dec = 0;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] -= b.Dig[i] + dec;
		if(c.Dig[i] < 0)
			c.Dig[i] += MaxSingle, dec = 1;
		else
			dec = 0;
	}
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator * (BigInt const &a, BigInt const &b)
{
	BigInt c;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = 0;
	int carry;
	for(int i = 0; i < a.Digs; i++)
	{
		carry = 0;
		for(int j = 0; j < b.Digs; j++)
		{
			c.Dig[i+j] += a.Dig[i] * b.Dig[j] + carry;
			carry = c.Dig[i+j] / MaxSingle;
			c.Dig[i+j] -= carry * MaxSingle;
		}
		if(carry != 0)
			c.Dig[i+b.Digs] += carry;
	}
	c.Digs = a.Digs + b.Digs;
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator * (BigInt const &a, int const &b)
{
	BigInt c = a;
	for(int i = 0; i < c.Digs; i++)
		c.Dig[i] *= b;
	int carry = 0;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] += carry;
		carry = c.Dig[i] / MaxSingle;
		c.Dig[i] -= carry * MaxSingle;
	}
	while(carry > 0)
		c.Dig[c.Digs++] = carry % MaxSingle, carry /= MaxSingle;
	return c;
}

BigInt operator + (BigInt const &a, int const &b)
{
	BigInt c = a;
	int carry = b;
	for(int i = 0; carry > 0; i++)
	{
		c.Dig[i] += carry;
		carry = c.Dig[i] / MaxSingle;
		c.Dig[i] -= carry * MaxSingle;
		if(i == c.Digs)
			c.Digs++;
	}
	return c;
}

bool operator < (BigInt const &a, BigInt const &b)
{
	if(a.Digs == b.Digs)
		for(int i = a.Digs - 1; i >= 0; i--)
			if(a.Dig[i] != b.Dig[i])
				return a.Dig[i] < b.Dig[i];
	return a.Digs < b.Digs;
}

bool operator == (BigInt const &a, BigInt const &b)
{
	if(a.Digs != b.Digs)
		return false;
	for(int i = 0; i < a.Digs; i++)
		if(a.Dig[i] != b.Dig[i])
			return false;
	return true;
}

BigInt operator / (BigInt const &a, BigInt const &b)
{
	BigInt c,t,m;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = t.Dig[i] = 0;
	t.Digs = 1;
	for(int i = a.Digs - 1; i >= 0; i--)
	{
		t = t * MaxSingle;
		t = t + a.Dig[i];
		int left = 0, right = MaxSingle, mid;
		while(left < right - 1)
		{
			mid = ((left + right)>> 1);
			m = b * mid;
			if(m < t) // m >= t
				left = mid;
			else
				if(m == t)
					left = right = mid;   // exit
				else
					right = mid;
		}
		m = b * left;
		c.Dig[i] = left;
		t = t - m;
	}
	c.Digs = a.Digs;
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator % (BigInt const &a, BigInt const &b)
{
	return a - (a / b) * b;
}

BigInt pow(BigInt const &a, int n)
{
	BigInt c,t;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = 0;
	c.Dig[0] = 1;
	c.Digs = 1;
	t = a;
	while(n > 0)
	{
		if(n & 1)
			c = c * t;
		t = t * t;
		n = (n>>1);
	}
	return c;
}
typedef struct
{
	bool isSell;
	int x;
}MSticks;

vector<int> res;
int n;
MSticks allMS[5010];

bool isVisit[5010];
int dp[5010];
vector< vector<int> > everyRes;

int main()
{
	//freopen("..\\case.in","r",stdin);
	scanf("%d", &n);
	string t_s;
	int x;
	int num_s = 0;
	for(int i = 0;i < n;i++)
	{
		cin>>t_s>>allMS[i].x;
		if(t_s == "win")
			allMS[i].isSell = false;
		else
		{
			allMS[i].isSell = true;
		}
	}

	for(int i = 0;i < n;i++)
	{
		vector<int> t;
		everyRes.push_back(t);
	}
	dp[0] = 0;
	for(int i = 1;i < n;i++)
	{
		dp[i] = dp[i - 1];
		everyRes[i] = everyRes[i - 1];
		for(int j = i - 1;j >= 0;j--)
		{
			if(allMS[i].isSell && !allMS[j].isSell && allMS[i].x == allMS[j].x)
			{
				if(dp[j] + allMS[j].x > dp[i])
				{
					dp[i] = dp[j] + allMS[j].x;
					everyRes[i] = everyRes[j];
					everyRes[i].push_back(allMS[j].x);
				}
			}
		}
	}

	if(everyRes[n - 1].size() == 0) printf("0\n");
	else
	{
		int all = 0;
		BigInt numRes;
		BigInt numTwo;
		numTwo = 2ll;
		numRes = pow(numTwo, everyRes[n - 1][0]);

		for(int i = 1;i < everyRes[n - 1].size();i++)
		{
			numRes = numRes + pow(numTwo, everyRes[n - 1][i]);
		}
		numRes.Print();
		printf("\n");
	}
	//system("Pause");
	return 0;
}


#include <cstdio>
#include <cstring>

#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;

string dp[5010];
int win[2010];
int n;

string pow2[2010];

void multi2( string &ress , const string &p ){

	int flag = 0;
	ress = "";
	for( int i = 0 ; i < p.size() ; i ++ ){
		ress += ( ( p[i] - '0' ) * 2 + flag ) % 10 + '0';
		flag = ( ( p[i] - '0' ) * 2 + flag ) / 10;
	}

	if( flag )
		ress += '1';

	int pos = ress.size() - 1;
	for( ; pos >= 0 && ress[pos] == '0' ; pos -- );
	ress = ress.substr( 0 , pos + 1 );

	if( ress == "" )
		ress = "0";

	return;
}
void add( string &ress , string num ){

	while( ress.size() < num.size() )
		ress += '0';

	while( num.size() < ress.size() )
		num += '0';

	int flag = 0;
	for( int i = 0 ; i < ress.size() ; i ++ ){
		char tRes = ( ress[i] - '0' + num[i] - '0' + flag ) % 10 + '0';
		flag = ( ress[i] - '0' + num[i] - '0' + flag ) / 10;

		ress[i] = tRes;

	}

	if( flag )
		ress += '1';

	int pos = ress.size() - 1;
	for( ; pos >= 0 && ress[pos] == '0' ; pos -- );
	ress = ress.substr( 0 , pos + 1 );

	if( ress == "" )
		ress = "0";

	return;
}
void initPow2( void ){

	pow2[0] = "1";
	for( int i = 1; i <= 2000 ; i ++ )
		multi2( pow2[i] , pow2[i-1] );
	return;
}

bool larger( const string &str1 , const string &str2 ){

	if( str1.size() > str2.size() )
		return true;

	if( str1.size() < str2.size() )
		return false;

	for( int i = str1.size() - 1 ; i >= 0 ; i -- )
		if( str1[i] > str2[i] )
			return true;

	return false;
}

int main( void ){

	char enter;
	char input[10];
	int t;

	dp[0] = "0";
	initPow2();
	memset( win , -1 ,sizeof( win ) );

	scanf("%d%c",&n,&enter);
	for( int i = 1 ; i <= n ; i ++ ){
		scanf("%s%c%d%c",input,&enter,&t,&enter);

		if( input[0] == 'w' ){
			win[ t ] = i;
			dp[i] = dp[i-1];
		}
		else{
			dp[i] = dp[i-1];
			if( win[t] != -1 ){
				string temp = pow2[ t ];
				add( temp , dp[ win[t] ] );

				if( larger( temp , dp[i] ) )
					dp[i] = temp;
			}
			/*if( win[t] != -1 ){
				string temp = pow2[ t ];
				add( temp , dp[ win[t] ] );

				if( larger( temp , dp[i-1] ) )
					dp[i] = temp;
				else
					dp[i] = dp[i-1];
			}
			else
				dp[i] = dp[i-1];*/
		}
	}

	reverse( dp[n].begin() , dp[n].end() );
	printf("%s\n",dp[n].c_str());

	//system("pause");

	return 0;
}


#include <cstdio>
#include <cstring>

#include <vector>
#include <string>
#include <algorithm>

using namespace std;

string dp[5001];
int win[2001];
int n;

string pow2[2001];

void multi2( string &ress , const string &p ){

	int flag = 0;
	ress = "";
	for( int i = 0 ; i < p.size() ; i ++ ){
		ress += ( ( p[i] - '0' ) * 2 + flag ) % 10 + '0';
		flag = ( ( p[i] - '0' ) * 2 + flag ) / 10;
	}

	if( flag )
		ress += '1';

	int pos = ress.size() - 1;
	for( ; pos >= 0 && ress[pos] == '0' ; pos -- );
	ress = ress.substr( 0 , pos + 1 );

	if( ress == "" )
		ress = "0";

	return;
}

void initPow2( void ){

	pow2[0] = "1";
	for( int i = 1; i <= 2000 ; i ++ )
		multi2( pow2[i] , pow2[i-1] );

	return;
}

void add( string &ress , string num ){

	while( ress.size() < num.size() )
		ress += '0';

	while( num.size() < ress.size() )
		num += '0';

	int flag = 0;
	for( int i = 0 ; i < ress.size() ; i ++ ){
		ress[i] = ( ress[i] - '0' + num[i] - '0' + flag ) % 10 + '0';
		flag = ( ress[i] - '0' + num[i] - '0' + flag ) / 10;
	}

	if( flag )
		ress += '1';

	int pos = ress.size() - 1;
	for( ; pos >= 0 && ress[pos] == '0' ; pos -- );
	ress = ress.substr( 0 , pos + 1 );

	if( ress == "" )
		ress = "0";

	return;
}

bool larger( const string &str1 , const string &str2 ){

	if( str1.size() > str2.size() )
		return true;

	if( str1.size() < str2.size() )
		return false;

	for( int i = str1.size() - 1 ; i >= 0 ; i -- )
		if( str1[i] > str2[i] )
			return true;

	return false;
}

int main( void ){

	char enter;
	char input[10];
	int t;

	dp[0] = "0";
	initPow2();
	memset( win , -1 ,sizeof( win ) );

	scanf("%d%c",&n,&enter);
	for( int i = 1 ; i <= n ; i ++ ){
		scanf("%s%c%d%c",input,&enter,&t,&enter);

		if( input[0] == 'w' ){
			win[ t ] = i;
			dp[i] = dp[i-1];
		}
		else{

			if( win[t] != -1 ){
				string temp = pow2[ t ];
				add( temp , dp[ win[t]-1 ] );

				if( larger( temp , dp[i-1] ) )
					dp[i] = temp;
				else
					dp[i] = dp[i-1];
			}
			else
				dp[i] = dp[i-1];
		}
	}

	reverse( dp[n].begin() , dp[n].end() );
	printf("%s\n",dp[n].c_str());

	//system("pause");

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <stack>
#include <string>
#include <algorithm>
#include <map>
#include <fstream>
#include <queue>
#include <cmath>
using namespace std;
#include <vector>
#include <string>
#include <list>
#include <map>
#include <utility>
#include <cmath>
#include <algorithm>
#include <sstream>
#include<iostream>
using namespace std;
int T;
int N;

#define MAXN 9999
#define DLEN 4
int const MaxBits = 900;
int const Bits = 4;
int const MaxLen = MaxBits / Bits + 1;
int const MaxSingle = 10000;

struct BigInt
{
	int Dig[MaxLen];
	int Digs;
	// void operator = (int n);
	void operator = (char *s);
	void operator = (long long n);
	void Print();
};

void BigInt::Print()
{
	printf("%d",Dig[Digs-1]);
	for(int i = Digs-2,tmp; i >= 0; i--)
	{
		tmp = MaxSingle / 10;
		while(tmp > 1)
		{
			if(Dig[i] < tmp)
				printf("0");
			else
				break;
			tmp /= 10;
		}
		printf("%d",Dig[i]);
	}
}

void BigInt::operator = (long long n)
{
	Digs = 0;
	while(n > 0)
	{
		Dig[Digs++] = n % MaxSingle;
		n /= MaxSingle;
	}
	for(int i = Digs; i < MaxLen; i++)
		Dig[i] = 0;
}

void BigInt::operator = (char *StrNum)
{
	int len = strlen(StrNum), tmp;
	Digs = 0;
	for( ; len >= Bits; len -= Bits)
	{
		tmp = 0;
		for(int i = len - Bits; i < len; i++)
			tmp *= 10, tmp += StrNum[i] - '0';
		Dig[Digs++] = tmp;
	}
	if(len == 0)
		return;
	tmp = 0;
	for(int i = 0; i < len; i++)
		tmp *= 10, tmp += StrNum[i] - '0';
	Dig[Digs++] = tmp;
	for(int i = Digs; i < MaxLen; i++)
		Dig[i] = 0;
}

BigInt operator + (BigInt const &a, BigInt const &b)
{
	BigInt c = a;
	int carry(0);
	c.Digs = c.Digs> b.Digs ? b.Digs : c.Digs;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] += b.Dig[i] + carry;
		if(c.Dig[i] >= MaxSingle)
			c.Dig[i] -= MaxSingle, carry = 1;
		else
			carry = 0;
	}
	if(carry > 0)
		c.Dig[c.Digs++] = carry;
	return c;
}

BigInt operator - (BigInt const &a, BigInt const &b)
{   // assume that a > b,  a and b are positive
	BigInt c = a;
	int dec = 0;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] -= b.Dig[i] + dec;
		if(c.Dig[i] < 0)
			c.Dig[i] += MaxSingle, dec = 1;
		else
			dec = 0;
	}
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator * (BigInt const &a, BigInt const &b)
{
	BigInt c;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = 0;
	int carry;
	for(int i = 0; i < a.Digs; i++)
	{
		carry = 0;
		for(int j = 0; j < b.Digs; j++)
		{
			c.Dig[i+j] += a.Dig[i] * b.Dig[j] + carry;
			carry = c.Dig[i+j] / MaxSingle;
			c.Dig[i+j] -= carry * MaxSingle;
		}
		if(carry != 0)
			c.Dig[i+b.Digs] += carry;
	}
	c.Digs = a.Digs + b.Digs;
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator * (BigInt const &a, int const &b)
{
	BigInt c = a;
	for(int i = 0; i < c.Digs; i++)
		c.Dig[i] *= b;
	int carry = 0;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] += carry;
		carry = c.Dig[i] / MaxSingle;
		c.Dig[i] -= carry * MaxSingle;
	}
	while(carry > 0)
		c.Dig[c.Digs++] = carry % MaxSingle, carry /= MaxSingle;
	return c;
}

BigInt operator + (BigInt const &a, int const &b)
{
	BigInt c = a;
	int carry = b;
	for(int i = 0; carry > 0; i++)
	{
		c.Dig[i] += carry;
		carry = c.Dig[i] / MaxSingle;
		c.Dig[i] -= carry * MaxSingle;
		if(i == c.Digs)
			c.Digs++;
	}
	return c;
}

bool operator < (BigInt const &a, BigInt const &b)
{
	if(a.Digs == b.Digs)
		for(int i = a.Digs - 1; i >= 0; i--)
			if(a.Dig[i] != b.Dig[i])
				return a.Dig[i] < b.Dig[i];
	return a.Digs < b.Digs;
}

bool operator == (BigInt const &a, BigInt const &b)
{
	if(a.Digs != b.Digs)
		return false;
	for(int i = 0; i < a.Digs; i++)
		if(a.Dig[i] != b.Dig[i])
			return false;
	return true;
}

BigInt operator / (BigInt const &a, BigInt const &b)
{
	BigInt c,t,m;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = t.Dig[i] = 0;
	t.Digs = 1;
	for(int i = a.Digs - 1; i >= 0; i--)
	{
		t = t * MaxSingle;
		t = t + a.Dig[i];
		int left = 0, right = MaxSingle, mid;
		while(left < right - 1)
		{
			mid = ((left + right)>> 1);
			m = b * mid;
			if(m < t) // m >= t
				left = mid;
			else
				if(m == t)
					left = right = mid;   // exit
				else
					right = mid;
		}
		m = b * left;
		c.Dig[i] = left;
		t = t - m;
	}
	c.Digs = a.Digs;
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator % (BigInt const &a, BigInt const &b)
{
	return a - (a / b) * b;
}

BigInt pow(BigInt const &a, int n)
{
	BigInt c,t;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = 0;
	c.Dig[0] = 1;
	c.Digs = 1;
	t = a;
	while(n > 0)
	{
		if(n & 1)
			c = c * t;
		t = t * t;
		n = (n>>1);
	}
	return c;
}
typedef struct
{
	bool isSell;
	int x;
}MSticks;
vector<int> res;
int n;
MSticks allMS[5010];
int main()
{
	//freopen("..\\case.in","r",stdin);
	scanf("%d", &n);
	string t_s;
	int x;
	for(int i = 0;i < n;i++)
	{
		cin>>t_s>>allMS[i].x;
		if(t_s == "win")
			allMS[i].isSell = false;
		else
			allMS[i].isSell = true;
	}

	int max_s = -1;
	int presell = 0;
	for(int i = 0;i < n;i++)
	{
		if(allMS[i].isSell)
		{
			for(int j = presell;j < i;j++)
			{
				if(allMS[j].isSell) continue;
				if(allMS[j].x == allMS[i].x)
					max_s = max(max_s, allMS[j].x);
			}
		}
		if(!allMS[i].isSell)
		{
			if(max_s != -1)
				res.push_back(max_s);
			if(i > 0 && allMS[i - 1].isSell)
				presell = max(0, i);
			max_s = -1;
		}
	}
	if(max_s != -1)
		res.push_back(max_s);
	n++;
	if(res.size() == 0) printf("0\n");
	else
	{
		int all = 0;
		BigInt numRes;
		numRes = 1ll;
		numRes = numRes - numRes;
		BigInt numTwo;
		numTwo = 2ll;
		for(int i = 0;i < res.size();i++)
		{
			numRes = numRes + pow(numTwo, res[i]);
		}
		numRes.Print();
		printf("\n");
	}
	//system("Pause");
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <stack>
#include <string>
#include <algorithm>
#include <map>
#include <fstream>
#include <queue>
#include <cmath>
using namespace std;
#include <vector>
#include <string>
#include <list>
#include <map>
#include <utility>
#include <cmath>
#include <algorithm>
#include <sstream>
#include<iostream>
using namespace std;
int T;
int N;

#define MAXN 9999
#define DLEN 4
int const MaxBits = 900 * 4;
int const Bits = 4;
int const MaxLen = MaxBits / Bits + 1;
int const MaxSingle = 10000;

struct BigInt
{
	int Dig[MaxLen];
	int Digs;
	//void operator = (int n);
	void operator = (char *s);
	void operator = (long long n);
	void Print();
};

void BigInt::Print()
{
	printf("%d",Dig[Digs-1]);
	for(int i = Digs-2,tmp; i >= 0; i--)
	{
		tmp = MaxSingle / 10;
		while(tmp > 1)
		{
			if(Dig[i] < tmp)
				printf("0");
			else
				break;
			tmp /= 10;
		}
		printf("%d",Dig[i]);
	}
}

void BigInt::operator = (long long n)
{
	Digs = 0;
	while(n > 0)
	{
		Dig[Digs++] = n % MaxSingle;
		n /= MaxSingle;
	}
	for(int i = Digs; i < MaxLen; i++)
		Dig[i] = 0;
}

void BigInt::operator = (char *StrNum)
{
	int len = strlen(StrNum), tmp;
	Digs = 0;
	for( ; len >= Bits; len -= Bits)
	{
		tmp = 0;
		for(int i = len - Bits; i < len; i++)
			tmp *= 10, tmp += StrNum[i] - '0';
		Dig[Digs++] = tmp;
	}
	if(len == 0)
		return;
	tmp = 0;
	for(int i = 0; i < len; i++)
		tmp *= 10, tmp += StrNum[i] - '0';
	Dig[Digs++] = tmp;
	for(int i = Digs; i < MaxLen; i++)
		Dig[i] = 0;
}

BigInt operator + (BigInt const &a, BigInt const &b)
{
	BigInt c = a;
	int carry(0);
	c.Digs = c.Digs < b.Digs ? b.Digs : c.Digs;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] += b.Dig[i] + carry;
		if(c.Dig[i] >= MaxSingle)
			c.Dig[i] -= MaxSingle, carry = 1;
		else
			carry = 0;
	}
	if(carry > 0)
		c.Dig[c.Digs++] = carry;
	return c;
}

BigInt operator - (BigInt const &a, BigInt const &b)
{   // assume that a > b,  a and b are positive
	BigInt c = a;
	int dec = 0;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] -= b.Dig[i] + dec;
		if(c.Dig[i] < 0)
			c.Dig[i] += MaxSingle, dec = 1;
		else
			dec = 0;
	}
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator * (BigInt const &a, BigInt const &b)
{
	BigInt c;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = 0;
	int carry;
	for(int i = 0; i < a.Digs; i++)
	{
		carry = 0;
		for(int j = 0; j < b.Digs; j++)
		{
			c.Dig[i+j] += a.Dig[i] * b.Dig[j] + carry;
			carry = c.Dig[i+j] / MaxSingle;
			c.Dig[i+j] -= carry * MaxSingle;
		}
		if(carry != 0)
			c.Dig[i+b.Digs] += carry;
	}
	c.Digs = a.Digs + b.Digs;
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator * (BigInt const &a, int const &b)
{
	BigInt c = a;
	for(int i = 0; i < c.Digs; i++)
		c.Dig[i] *= b;
	int carry = 0;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] += carry;
		carry = c.Dig[i] / MaxSingle;
		c.Dig[i] -= carry * MaxSingle;
	}
	while(carry > 0)
		c.Dig[c.Digs++] = carry % MaxSingle, carry /= MaxSingle;
	return c;
}

BigInt operator + (BigInt const &a, int const &b)
{
	BigInt c = a;
	int carry = b;
	for(int i = 0; carry > 0; i++)
	{
		c.Dig[i] += carry;
		carry = c.Dig[i] / MaxSingle;
		c.Dig[i] -= carry * MaxSingle;
		if(i == c.Digs)
			c.Digs++;
	}
	return c;
}

bool operator < (BigInt const &a, BigInt const &b)
{
	if(a.Digs == b.Digs)
		for(int i = a.Digs - 1; i >= 0; i--)
			if(a.Dig[i] != b.Dig[i])
				return a.Dig[i] < b.Dig[i];
	return a.Digs < b.Digs;
}

bool operator == (BigInt const &a, BigInt const &b)
{
	if(a.Digs != b.Digs)
		return false;
	for(int i = 0; i < a.Digs; i++)
		if(a.Dig[i] != b.Dig[i])
			return false;
	return true;
}

BigInt operator / (BigInt const &a, BigInt const &b)
{
	BigInt c,t,m;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = t.Dig[i] = 0;
	t.Digs = 1;
	for(int i = a.Digs - 1; i >= 0; i--)
	{
		t = t * MaxSingle;
		t = t + a.Dig[i];
		int left = 0, right = MaxSingle, mid;
		while(left < right - 1)
		{
			mid = ((left + right)>> 1);
			m = b * mid;
			if(m < t) // m >= t
				left = mid;
			else
				if(m == t)
					left = right = mid;   // exit
				else
					right = mid;
		}
		m = b * left;
		c.Dig[i] = left;
		t = t - m;
	}
	c.Digs = a.Digs;
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator % (BigInt const &a, BigInt const &b)
{
	return a - (a / b) * b;
}

BigInt pow(BigInt const &a, int n)
{
	BigInt c,t;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = 0;
	c.Dig[0] = 1;
	c.Digs = 1;
	t = a;
	while(n > 0)
	{
		if(n & 1)
			c = c * t;
		t = t * t;
		n = (n>>1);
	}
	return c;
}

typedef struct
{
	bool isSell;
	int x;
}MSticks;

vector<int> res;
int n;
MSticks allMS[5010];

bool isVisit[5010];
BigInt dp[5010];

int main()
{
	//freopen("..\\case.in","r",stdin);
	scanf("%d", &n);
	string t_s;
	int x;
	int num_s = 0;
	for(int i = 0;i < n;i++)
	{
		cin>>t_s>>allMS[i].x;
		if(t_s == "win")
			allMS[i].isSell = false;
		else
			allMS[i].isSell = true;
	}

	BigInt num2;
	num2 = "2";

	dp[0] = "0";

	for(int i = 1;i < n;i++)
	{
		dp[i] = dp[i - 1];
		for(int j = i - 1;j >= 0;j--)
		{
			if(allMS[i].isSell && !allMS[j].isSell && allMS[i].x == allMS[j].x)
			{
				if(dp[i] < (dp[j] +  pow(num2, allMS[j].x)))
				{
					dp[i] = dp[j] +  pow(num2, allMS[j].x);
				}
			}
		}
	}

	dp[n - 1].Print();
	printf("\n");
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <stack>
#include <string>
#include <algorithm>
#include <map>
#include <fstream>
#include <queue>
#include <cmath>
using namespace std;
#include <vector>
#include <string>
#include <list>
#include <map>
#include <utility>
#include <cmath>
#include <algorithm>
#include <sstream>
#include<iostream>
using namespace std;
int T;
int N;

#define MAXN 9999
#define DLEN 4
int const MaxBits = 900 * 4;
int const Bits = 4;
int const MaxLen = MaxBits / Bits + 1;
int const MaxSingle = 10000;

struct BigInt
{
	int Dig[MaxLen];
	int Digs;
	//void operator = (int n);
	void operator = (char *s);
	void operator = (long long n);
	void Print();
};

void BigInt::Print()
{
	printf("%d",Dig[Digs-1]);
	for(int i = Digs-2,tmp; i >= 0; i--)
	{
		tmp = MaxSingle / 10;
		while(tmp > 1)
		{
			if(Dig[i] < tmp)
				printf("0");
			else
				break;
			tmp /= 10;
		}
		printf("%d",Dig[i]);
	}
}

void BigInt::operator = (long long n)
{
	Digs = 0;
	while(n > 0)
	{
		Dig[Digs++] = n % MaxSingle;
		n /= MaxSingle;
	}
	for(int i = Digs; i < MaxLen; i++)
		Dig[i] = 0;
}

void BigInt::operator = (char *StrNum)
{
	int len = strlen(StrNum), tmp;
	Digs = 0;
	for( ; len >= Bits; len -= Bits)
	{
		tmp = 0;
		for(int i = len - Bits; i < len; i++)
			tmp *= 10, tmp += StrNum[i] - '0';
		Dig[Digs++] = tmp;
	}
	if(len == 0)
		return;
	tmp = 0;
	for(int i = 0; i < len; i++)
		tmp *= 10, tmp += StrNum[i] - '0';
	Dig[Digs++] = tmp;
	for(int i = Digs; i < MaxLen; i++)
		Dig[i] = 0;
}

BigInt operator + (BigInt const &a, BigInt const &b)
{
	BigInt c = a;
	int carry(0);
	c.Digs = c.Digs < b.Digs ? b.Digs : c.Digs;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] += b.Dig[i] + carry;
		if(c.Dig[i] >= MaxSingle)
			c.Dig[i] -= MaxSingle, carry = 1;
		else
			carry = 0;
	}
	if(carry > 0)
		c.Dig[c.Digs++] = carry;
	return c;
}

BigInt operator - (BigInt const &a, BigInt const &b)
{   // assume that a > b,  a and b are positive
	BigInt c = a;
	int dec = 0;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] -= b.Dig[i] + dec;
		if(c.Dig[i] < 0)
			c.Dig[i] += MaxSingle, dec = 1;
		else
			dec = 0;
	}
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator * (BigInt const &a, BigInt const &b)
{
	BigInt c;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = 0;
	int carry;
	for(int i = 0; i < a.Digs; i++)
	{
		carry = 0;
		for(int j = 0; j < b.Digs; j++)
		{
			c.Dig[i+j] += a.Dig[i] * b.Dig[j] + carry;
			carry = c.Dig[i+j] / MaxSingle;
			c.Dig[i+j] -= carry * MaxSingle;
		}
		if(carry != 0)
			c.Dig[i+b.Digs] += carry;
	}
	c.Digs = a.Digs + b.Digs;
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator * (BigInt const &a, int const &b)
{
	BigInt c = a;
	for(int i = 0; i < c.Digs; i++)
		c.Dig[i] *= b;
	int carry = 0;
	for(int i = 0; i < c.Digs; i++)
	{
		c.Dig[i] += carry;
		carry = c.Dig[i] / MaxSingle;
		c.Dig[i] -= carry * MaxSingle;
	}
	while(carry > 0)
		c.Dig[c.Digs++] = carry % MaxSingle, carry /= MaxSingle;
	return c;
}

BigInt operator + (BigInt const &a, int const &b)
{
	BigInt c = a;
	int carry = b;
	for(int i = 0; carry > 0; i++)
	{
		c.Dig[i] += carry;
		carry = c.Dig[i] / MaxSingle;
		c.Dig[i] -= carry * MaxSingle;
		if(i == c.Digs)
			c.Digs++;
	}
	return c;
}

bool operator < (BigInt const &a, BigInt const &b)
{
	if(a.Digs == b.Digs)
		for(int i = a.Digs - 1; i >= 0; i--)
			if(a.Dig[i] != b.Dig[i])
				return a.Dig[i] < b.Dig[i];
	return a.Digs < b.Digs;
}

bool operator == (BigInt const &a, BigInt const &b)
{
	if(a.Digs != b.Digs)
		return false;
	for(int i = 0; i < a.Digs; i++)
		if(a.Dig[i] != b.Dig[i])
			return false;
	return true;
}

BigInt operator / (BigInt const &a, BigInt const &b)
{
	BigInt c,t,m;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = t.Dig[i] = 0;
	t.Digs = 1;
	for(int i = a.Digs - 1; i >= 0; i--)
	{
		t = t * MaxSingle;
		t = t + a.Dig[i];
		int left = 0, right = MaxSingle, mid;
		while(left < right - 1)
		{
			mid = ((left + right)>> 1);
			m = b * mid;
			if(m < t) // m >= t
				left = mid;
			else
				if(m == t)
					left = right = mid;   // exit
				else
					right = mid;
		}
		m = b * left;
		c.Dig[i] = left;
		t = t - m;
	}
	c.Digs = a.Digs;
	while(c.Digs > 1 && c.Dig[c.Digs-1] == 0)
		c.Digs--;
	return c;
}

BigInt operator % (BigInt const &a, BigInt const &b)
{
	return a - (a / b) * b;
}

BigInt pow(BigInt const &a, int n)
{
	BigInt c,t;
	for(int i = 0; i < MaxLen; i++)
		c.Dig[i] = 0;
	c.Dig[0] = 1;
	c.Digs = 1;
	t = a;
	while(n > 0)
	{
		if(n & 1)
			c = c * t;
		t = t * t;
		n = (n>>1);
	}
	return c;
}

typedef struct
{
	bool isSell;
	int x;
}MSticks;

vector<int> res;
int n;
MSticks allMS[5010];

bool isVisit[5010];
BigInt dp[5010];

int main()
{
	//freopen("..\\case.in","r",stdin);
	scanf("%d", &n);
	string t_s;
	int x;
	int num_s = 0;
	for(int i = 0;i < n;i++)
	{
		cin>>t_s>>allMS[i].x;
		if(t_s == "win")
			allMS[i].isSell = false;
		else
			allMS[i].isSell = true;
	}

	BigInt num2;
	num2 = "2";

	dp[0] = "0";

	for(int i = 1;i < n;i++)
	{
		dp[i] = dp[i - 1];
		for(int j = i - 1;j >= 0;j--)
		{
			if(allMS[i].isSell && !allMS[j].isSell && allMS[i].x == allMS[j].x)
			{
				if(dp[i] < (dp[j] +  pow(num2, allMS[j].x)))
				{
					dp[i] = dp[j] +  pow(num2, allMS[j].x);
				}
				break;
			}
		}
	}

	dp[n - 1].Print();
	printf("\n");
	return 0;
}


#include <cstdio>
#include <cstring>

#include <vector>
#include <string>
#include <algorithm>
#include <iostream>
using namespace std;

string dp[5010];
int win[2010];
int n;

string pow2[2010];

void multi2( string &ress , const string &p ){

	int flag = 0;
	ress = "";
	for( int i = 0 ; i < p.size() ; i ++ ){
		ress += ( ( p[i] - '0' ) * 2 + flag ) % 10 + '0';
		flag = ( ( p[i] - '0' ) * 2 + flag ) / 10;
	}

	if( flag )
		ress += '1';

	int pos = ress.size() - 1;
	for( ; pos >= 0 && ress[pos] == '0' ; pos -- );
	ress = ress.substr( 0 , pos + 1 );

	if( ress == "" )
		ress = "0";

	return;
}
void add( string &ress , string num ){

	while( ress.size() < num.size() )
		ress += '0';

	while( num.size() < ress.size() )
		num += '0';

	int flag = 0;
	for( int i = 0 ; i < ress.size() ; i ++ ){
		char tRes = ( ress[i] - '0' + num[i] - '0' + flag ) % 10 + '0';
		flag = ( ress[i] - '0' + num[i] - '0' + flag ) / 10;

		ress[i] = tRes;

	}

	if( flag )
		ress += '1';

	int pos = ress.size() - 1;
	for( ; pos >= 0 && ress[pos] == '0' ; pos -- );
	ress = ress.substr( 0 , pos + 1 );

	if( ress == "" )
		ress = "0";

	return;
}
void initPow2( void ){

	pow2[0] = "1";
	for( int i = 1; i <= 2000 ; i ++ )
		multi2( pow2[i] , pow2[i-1] );
	return;
}

bool larger( const string &str1 , const string &str2 ){

	if( str1.size() > str2.size() )
		return true;

	if( str1.size() < str2.size() )
		return false;

	for( int i = str1.size() - 1 ; i >= 0 ; i -- )
		if( str1[i] > str2[i] )
			return true;

	return false;
}

int main( void ){

	char enter;
	char input[10];
	int t;

	dp[0] = "0";
	initPow2();
	memset( win , -1 ,sizeof( win ) );

	scanf("%d%c",&n,&enter);
	for( int i = 1 ; i <= n ; i ++ ){
		scanf("%s%c%d%c",input,&enter,&t,&enter);

		if( input[0] == 'w' ){
			win[ t ] = i;
			dp[i] = dp[i-1];
		}
		else{
			dp[i] = dp[i-1];
			if( win[t] != -1 ){
				string temp = pow2[ t ];
				add( temp , dp[ win[t] ] );

				if( larger( temp , dp[i-1] ) )
					dp[i] = temp;
			}
			/*if( win[t] != -1 ){
				string temp = pow2[ t ];
				add( temp , dp[ win[t] ] );

				if( larger( temp , dp[i-1] ) )
					dp[i] = temp;
				else
					dp[i] = dp[i-1];
			}
			else
				dp[i] = dp[i-1];*/
		}
	}

	reverse( dp[n].begin() , dp[n].end() );
	printf("%s\n",dp[n].c_str());

	//system("pause");

	return 0;
}