import java.io.BufferedInputStream;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static final BigInteger neg = BigInteger.valueOf(-1);
    public static final BigInteger two = BigInteger.valueOf(2);

    public static BigInteger[][] dp = new BigInteger[2002][5001];
    public static String[] s = new String[5001];
    public static int[] a = new int[5001];
    public static int n;

    public static BigInteger calc(int last, int cur) {

        if( cur >= n )
            return BigInteger.ZERO;

        if( !dp[last][cur].equals(neg) )
            return dp[last][cur];

        dp[last][cur] = BigInteger.ZERO;

        if( a[cur] == last && s[cur].equals("sell") )
            dp[last][cur] = calc(0, cur+1).add(two.pow(a[cur]));

        BigInteger r1 = BigInteger.ZERO, r2 = BigInteger.ZERO;

        if( s[cur].equals("win") )
            r1 = calc(a[cur], cur+1);

        r2 = calc(last, cur+1);

        return dp[last][cur] = r1.max(r2).max(dp[last][cur]);
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedInputStream(System.in));

        while( scan.hasNext() )
        {
            n = scan.nextInt();

            for( int i = 0 ; i < 2002 ; i++ )
                for( int j = 0 ; j < 5001 ; j++ )
                    dp[i][j] = neg;

            for( int i = 0 ; i < n ; i++ )
            {
                s[i] = scan.next();
                a[i] = scan.nextInt();
            }

            System.out.println(calc(0, 0));
        }
    }
}


import java.io.BufferedInputStream;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static final BigInteger neg = BigInteger.valueOf(-1);
    public static final BigInteger two = BigInteger.valueOf(2);

    public static BigInteger[][] dp = new BigInteger[2002][5001];
    public static String[] s = new String[5001];
    public static int[] a = new int[5001];
    public static int n;

    public static BigInteger calc(int last, int cur) {

        if( cur >= n )
            return BigInteger.ZERO;

        if( !dp[last][cur].equals(neg) )
            return dp[last][cur];

        dp[last][cur] = BigInteger.ZERO;

        if( a[cur] == last && s[cur].equals("sell") )
            dp[last][cur] = calc(2001, cur+1).add(two.pow(a[cur]));

        BigInteger r1 = BigInteger.ZERO, r2 = BigInteger.ZERO;

        if( s[cur].equals("win") )
            r1 = calc(a[cur], cur+1);

        r2 = calc(last, cur+1);

        return dp[last][cur] = r1.max(r2).max(dp[last][cur]);
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedInputStream(System.in));

        while( scan.hasNext() )
        {
            n = scan.nextInt();

            for( int i = 0 ; i < 2002 ; i++ )
                for( int j = 0 ; j < 5001 ; j++ )
                    dp[i][j] = neg;

            for( int i = 0 ; i < n ; i++ )
            {
                s[i] = scan.next();
                a[i] = scan.nextInt();
            }

            System.out.println(calc(0, 0));
        }
    }
}


import java.io.BufferedInputStream;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static final BigInteger neg = BigInteger.valueOf(-1);
    public static final BigInteger two = BigInteger.valueOf(2);

    public static BigInteger[][] dp = new BigInteger[2002][5001];
    public static String[] s = new String[5001];
    public static int[] a = new int[5001];
    public static int n;

    public static BigInteger calc(int last, int cur) {

        if( cur >= n )
            return BigInteger.ZERO;

        BigInteger x = dp[last][cur];

        if( !x.equals(neg) )
            return x;

        x = BigInteger.ZERO;

        if( a[cur] == last && s[cur].equals("sell") )
            x = calc(0, cur+1).add(two.pow(a[cur]));

        BigInteger r1 = BigInteger.ZERO, r2 = BigInteger.ZERO;

        if( s[cur].equals("win") )
            r1 = calc(a[cur], cur+1);

        r2 = calc(last, cur+1);

        return x = r1.max(r2).max(x);
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedInputStream(System.in));

        while( scan.hasNext() )
        {
            n = scan.nextInt();

            for( int i = 0 ; i < 2002 ; i++ )
                for( int j = 0 ; j < 5001 ; j++ )
                    dp[i][j] = neg;

            for( int i = 0 ; i < n ; i++ )
            {
                s[i] = scan.next();
                a[i] = scan.nextInt();
            }

            System.out.println(calc(0, 0));
        }
    }
}


import java.io.BufferedInputStream;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static BigInteger[][] dp = new BigInteger[5001][5001];
    public static String[] s = new String[5001];
    public static int[] a = new int[5001];
    public static int n;

    public static BigInteger calc(int last, int cur) {

        if( cur >= n || last >= n )
            return BigInteger.ZERO;

        BigInteger x = dp[last][cur];

        if( !x.equals(BigInteger.valueOf(-1)) )
            return x;

        x = BigInteger.ZERO;

        if( a[cur] == a[last] && s[cur].equals("sell") && s[last].equals("win") )
            x = calc(cur+1, cur+1).add(BigInteger.valueOf(2).pow(a[cur]));

        BigInteger r1 = calc(last, cur+1);
        BigInteger r2 = calc(last+1, cur);

        return x = new BigInteger(r1.max(r2).max(x).toString());
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedInputStream(System.in));

        while( scan.hasNext() )
        {
            n = scan.nextInt();

            for( int i = 0 ; i < n ; i++ )
                for( int j = 0 ; j < n ; j++ )
                    dp[i][j] = new BigInteger("-1");

            for( int i = 0 ; i < n ; i++ )
            {
                s[i] = scan.next();
                a[i] = scan.nextInt();
            }

            System.out.println(calc(0, 0));
        }
    }
}


import java.io.*;
import java.math.*;
import java.util.*;

public class Solution {
    final static int M = 2001;

    public void run() {
        try {
            int n = reader.nextInt();
            int[] hash = new int[M];
            Arrays.fill(hash, -1);
            int[][] order = new int[M][];
            for (int i = 0; i < n; ++ i) {
                String type = reader.next();
                int x = reader.nextInt();
                if (type.equals("win")) {
                    hash[x] = i;
                } else if (hash[x] != -1) {
                    order[x] = new int[]{hash[x], i};
                }
            }
            boolean[] used = new boolean[n];
            boolean[] pick = new boolean[M];
            for (int i = M - 1; i >= 0; -- i) {
                if (order[i] == null) {
                    continue;
                }
                boolean valid = true;
                for (int x = order[i][0]; x <= order[i][1]; ++ x) {
                    valid &= !used[x];
                }
                if (valid) {
                    pick[i] = true;
                    for (int x = order[i][0]; x <= order[i][1]; ++ x) {
                        used[x] = true;
                    }
                }
            }
            BigInteger answer = BigInteger.ZERO;
            BigInteger power = BigInteger.ONE;
            for (int i = 0; i < M; ++ i) {
                if (pick[i]) {
                    answer = answer.add(power);
                }
                power = power.multiply(BigInteger.valueOf(2));
            }
            writer.println(answer);
        } catch (IOException ex) {
        }
        writer.close();
    }

    InputReader reader;
    PrintWriter writer;

    Solution() {
        reader = new InputReader();
        writer = new PrintWriter(System.out);
    }

    public static void main(String[] args) {
        new Solution().run();
    }

}

class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    InputReader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }

    Integer nextInt() throws IOException {
        return Integer.parseInt(next());
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

public class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        Scanner cin=new Scanner(System.in);
        int n=cin.nextInt();
        int[] next=new int[2001];
        int[] val=new int[n];
        BigInteger[] dp=new BigInteger[n+1];
        BigInteger[] p2=new BigInteger[2001];
        p2[0]=BigInteger.ONE;
        for(int i=1;i<=2000;++i)
            p2[i]=p2[i-1].multiply(BigInteger.valueOf(2));
        String s;
        for(int i=0;i<n;++i){
            s=cin.next();
            val[i]=cin.nextInt();
            next[val[i]]=i;
        }
        dp[n]=BigInteger.ZERO;
        BigInteger tmp;
        for(int i=n-1;i>=0;--i){
            dp[i]=dp[i+1];
            if(next[val[i]]!=i){
                tmp=dp[next[val[i]]].add(p2[val[i]]);
                if(dp[i].compareTo(tmp)<0)
                    dp[i]=tmp;
            }
        }
        System.out.println(dp[0]);
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.*;

public class Main
{
    public static void main (String[] args) throws java.lang.Exception
    {
        Scanner cin=new Scanner(System.in);
        int n=cin.nextInt();
        int[] next=new int[n];
        int[] val=new int[n];
        BigInteger[] dp=new BigInteger[n+1];
        BigInteger[] p2=new BigInteger[2001];
        p2[0]=BigInteger.ONE;
        for(int i=1;i<=2000;++i)
            p2[i]=p2[i-1].multiply(BigInteger.valueOf(2));
        String[] s=new String[n];
        for(int i=0;i<n;++i){
            s[i]=cin.next();
            val[i]=cin.nextInt();
        }
        for(int i=0;i<n;++i){
            next[i]=-1;
            if(s[i].equals("win"))
                for(int j=i+1;j<n;++j)
                    if(val[j]==val[i] && s[j].equals("sell"))
                        next[i]=j;
        }
        dp[n]=BigInteger.ZERO;
        BigInteger tmp;
        for(int i=n-1;i>=0;--i){
            dp[i]=dp[i+1];
            if(next[i]!=-1){
                tmp=dp[next[i]].add(p2[val[i]]);
                if(dp[i].compareTo(tmp)<0)
                    dp[i]=tmp;
            }
        }
        System.out.println(dp[0]);
    }
}


import java.io.*;
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a[] = new int[2048];
            int v[] = new int[6000];
            for (int i = 0; i < a.length; i++) {
                a[i] = -1;
            }
            BigInteger b [] = new BigInteger[6000];
            int n = in.nextInt();
            int x;
            BigInteger c = BigInteger.ZERO;
            String type;
            for (int i = 0; i < n; i++) {
                type = in.next();
                v[i] = x = in.nextInt();
                if (Objects.equals(type, "win")) {
                    b[i] = c;
                    a[x] = i;
                } else {
                    if (a[x] != -1) {
                        c = b[i] = b[a[x]].add(BigInteger.valueOf(2).pow(v[a[x]])).max(c);
                    }
                }
            }
            out.println(c.toString());
            /*BigInteger a = new BigInteger(in.next());
            BigInteger b = new BigInteger(in.next());
            BigDecimal d = BigDecimal.valueOf(in.nextDouble());
            List<Integer> l = new ArrayList<Integer>();

            Set<Integer> s = new TreeSet<Integer>();
            for (Integer aa : s) {
                out.print(aa);
            }
            Map<Integer, String> m = new HashMap<>();
            for (Integer integer : m.keySet()) {
                out.print(m.get(integer));
            }
            Iterator<Map.Entry<Integer, String>> jt = m.entrySet().iterator();
            Collections.sort(l, new Comparator<Integer>() {
                @Override
                public int compare(Integer integer, Integer t1) {
                    return 0;
                }
            });*/
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}

// Tue Mar 29 2016 22:33:58 GMT+0300 (MSK)


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main  {

    public static void main(String[] args) throws IOException{
        //InputStream inputStream = new  File("input.txt");
        //OutputStream outputStream = new File("output.txt");

        //Scanner in = new Scanner(new File("input.txt"));
        //PrintWriter out = new PrintWriter(new File("output.txt"));

        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int[] fs = new int[2010];
        int[] ls = new int[2010];
        for(int i = 0; i < 2010; ++i){
            ls[i] = -1;
            fs[i] = -1;
        }

        int n = in.nextInt();
        String s;
        int x;

        for(int i = 0; i < n; ++i){
            s = in.next();
            x = in.nextInt();

            if(Objects.equals(s, "win")){
                if(ls[x] == -1) {
                    fs[x] = i;
                }
            }else{
                ls[x] = i;
            }
        }

        BigInteger sum = BigInteger.ZERO;
        int[] t = new int[5010];
        for(int i = 0; i < 5010; ++i){
            t[i] = -1;
        }
        for(int i = 2000; i >= 0; --i){
            if(fs[i] != -1 && ls[i] != -1 && fs[i] < ls[i]) {
                Boolean b = true;
                for (int j = fs[i]; j <= ls[i]; ++j){
                    if(t[j] != -1){
                        b = false;
                        break;
                    }
                }

                if(b){
                    sum = sum.add(BigInteger.valueOf(2).pow(i));
                    for(int j = fs[i]; j <= ls[i]; ++j){
                        t[j] = 1;
                    }
                }

            }
        }

        out.println(sum.toString());

        out.flush();
    }
}

// Thu Mar 31 2016 20:36:25 GMT+0300 (MSK)


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class Main  {

    public static void main(String[] args) throws IOException{
        //InputStream inputStream = new  File("input.txt");
        //OutputStream outputStream = new File("output.txt");

        //Scanner in = new Scanner(new File("input.txt"));
        //PrintWriter out = new PrintWriter(new File("output.txt"));

        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int[] fs = new int[2010];
        int[] ls = new int[2010];
        for(int i = 0; i < 2010; ++i){
            ls[i] = -1;
            fs[i] = -1;
        }

        int n = in.nextInt();
        String s;
        int x;

        for(int i = 0; i < n; ++i){
            s = in.next();
            x = in.nextInt();

            if(Objects.equals(s, "win")){
                if(ls[x] == -1) {
                    fs[x] = i;
                }
            }else{
                ls[x] = i;
            }
        }

        BigInteger sum = BigInteger.ZERO;
        int[] t = new int[5010];
        for(int i = 0; i < 5010; ++i){
            t[i] = -1;
        }
        for(int i = 2000; i >= 0; --i){
            if(fs[i] != -1 && ls[i] != -1 && fs[i] < ls[i]) {
                Boolean b = true;
                for (int j = fs[i]; j <= ls[i]; ++j){
                    if(t[j] != -1){
                        b = false;
                        break;
                    }
                }

                if(b){
                    sum = sum.add(BigInteger.valueOf(2).pow(i));
                    for(int j = fs[i]; j <= ls[i]; ++j){
                        t[j] = 1;
                    }
                }

            }
        }

        out.println(sum.toString());

        out.flush();
    }
}

// Thu Mar 31 2016 20:37:23 GMT+0300 (MSK)


import java.io.*;
import java.util.*;
import java.math.*;

public class Main
{
    public static void main ( String[] args ) throws IOException
    {
        Scanner in = new Scanner(System.in);
        BufferedReader Reader = new BufferedReader(new InputStreamReader(System.in));
        FastScanner sc = new FastScanner(Reader);
        int n = in.nextInt();
        BigInteger[] dp = new BigInteger[n];
        int[] values = new int[n];
        boolean[] types = new boolean[n];
        for (int i = 0; i < n; ++i)
        {
            String operation = in.next();
            if (operation.compareTo("win") == 0)
                types[i] = true;
            values[i] = in.nextInt();
            if (i > 0)
                dp[i] = dp[i - 1];
            else
                dp[i] = BigInteger.ZERO;
            int ind = i - 1;
            while (ind >= 0)
            {
                if (types[ind] && values[ind] == values[i])
                    break;
                --ind;
            }
            if (ind >= 0)
            {
                BigInteger tmp = ind > 0 ? dp[ind - 1] : BigInteger.ZERO;
                tmp = tmp.add(BigInteger.valueOf(2).pow(values[i]));
                if (tmp.compareTo(dp[i]) == 1)
                    dp[i] = tmp;
            }
        }
    /*  for (int i = 0; i < n; ++i)
            System.out.print(dp[i] + " ");*/
        System.out.print(dp[n - 1]);
        System.out.close();
    }
}

class FastScanner
{
    private BufferedReader Reader;
    private StringTokenizer Tokenizer;
    public FastScanner (BufferedReader Reader)
    {
        this.Reader = Reader;
    }
    public String nextToken() throws IOException
    {
        while (Tokenizer == null || !Tokenizer.hasMoreTokens())
            Tokenizer = new StringTokenizer(Reader.readLine());
        return Tokenizer.nextToken();
    }
    public int nextInt() throws NumberFormatException, IOException
    {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws NumberFormatException, IOException
    {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws NumberFormatException, IOException
    {
        return Double.parseDouble(nextToken());
    }
}


import java.io.*;
import java.util.*;
import java.math.*;

public class Main
{
    public static void main ( String[] args ) throws IOException
    {
        Scanner in = new Scanner(System.in);
        BufferedReader Reader = new BufferedReader(new InputStreamReader(System.in));
        FastScanner sc = new FastScanner(Reader);
        int n = in.nextInt();
        BigInteger[] dp = new BigInteger[n];
        int[] values = new int[n];
        boolean[] types = new boolean[n];
        for (int i = 0; i < n; ++i)
        {
            String operation = in.next();
            if (operation.compareTo("win") == 0)
                types[i] = true;
            values[i] = in.nextInt();
            if (i > 0)
                dp[i] = dp[i - 1];
            else
                dp[i] = BigInteger.ZERO;
            int ind = i - 1;
            if (types[i])
                continue;
            while (ind >= 0)
            {
                if (types[ind] && values[ind] == values[i])
                    break;
                --ind;
            }
            if (ind >= 0)
            {
                BigInteger tmp = ind > 0 ? dp[ind - 1] : BigInteger.ZERO;
                tmp = tmp.add(BigInteger.valueOf(2).pow(values[i]));
                if (tmp.compareTo(dp[i]) == 1)
                    dp[i] = tmp;
            }
        }
    /*  for (int i = 0; i < n; ++i)
            System.out.print(dp[i] + " ");*/
        System.out.print(dp[n - 1]);
        System.out.close();
    }
}

class FastScanner
{
    private BufferedReader Reader;
    private StringTokenizer Tokenizer;
    public FastScanner (BufferedReader Reader)
    {
        this.Reader = Reader;
    }
    public String nextToken() throws IOException
    {
        while (Tokenizer == null || !Tokenizer.hasMoreTokens())
            Tokenizer = new StringTokenizer(Reader.readLine());
        return Tokenizer.nextToken();
    }
    public int nextInt() throws NumberFormatException, IOException
    {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws NumberFormatException, IOException
    {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws NumberFormatException, IOException
    {
        return Double.parseDouble(nextToken());
    }
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

public class a {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);

		int n = in.nextInt(), m, nquery = 0;
		int [] query = new int[5001];
		boolean[] stat = new boolean [2001];
		String s;
		BigInteger ans = new BigInteger("0");
		BigInteger dua[] = new BigInteger[2001];

		dua[0] = new BigInteger("1");

		for(int i = 1; i < 2001; i++)
		dua[i] = dua[i-1].multiply(BigInteger.valueOf(2));

		Arrays.fill(stat,false);

		while (n > 0) {
			s = in.next();
			m = in.nextInt();

			if (s.equals("win")) {
				if (nquery > 0) {
					Arrays.sort(query,0,nquery);

					for(int i = nquery - 1; i >= 0; i--) {
						int x = query[i];

						if (stat[x]) {
							//out.println(x);
							ans = ans.add( dua[x] );
							Arrays.fill(stat,false);
							nquery = 0;
							break;
						}
					}
				}

				stat[m] = true;
			} else {
				query[ nquery ] = m;
				nquery++;
			}

			n--;
		}

		if (nquery > 0) {
			Arrays.sort(query,0,nquery);

			for(int i = nquery - 1; i >= 0; i--) {
				int x = query[i];

				if (stat[x]) {
					//out.println(x);
					ans = ans.add( dua[x] );
					Arrays.fill(stat,false);
					nquery = 0;
					break;
				}
			}
		}

		out.println(ans);
		out.close();
	}
}

/* Java Template */
class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

public class a {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);

		int n = in.nextInt(), m, nquery = 0;
		int [] query = new int[5001];
		boolean[] stat = new boolean [2001];
		String s;
		BigInteger ans = new BigInteger("0");
		BigInteger dua[] = new BigInteger[2001];

		dua[0] = new BigInteger("1");

		for(int i = 1; i < 2001; i++)
		dua[i] = dua[i-1].multiply(BigInteger.valueOf(2));

		Arrays.fill(stat,false);

		while (n > 0) {
			s = in.next();
			m = in.nextInt();

			if (s.equals("win")) {
				if (nquery > 0) {
					Arrays.sort(query,0,nquery);

					int x = query[ nquery-1 ];
					if (stat[x]) {
						ans = ans.add( dua[x] );
						Arrays.fill(stat,false);
						nquery = 0;
					}
				}

				stat[m] = true;
			} else {
				query[ nquery ] = m;
				nquery++;
			}

			n--;
		}

		if (nquery > 0) {
			Arrays.sort(query,0,nquery-1);

			int x = query[ nquery-1 ];
			if (stat[x]) {
				out.println(x);
				ans = ans.add( dua[x] );
				Arrays.fill(stat,false);
				nquery = 0;
			}
		}

		out.println(ans);
		out.close();
	}
}

/* Java Template */
class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

public class a {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int[] sell = new int[5005];
        int[] lastWin = new int[5005];
        int[] it = new int[5005];
        boolean[] done = new boolean[5005];
        String[] op = new String[5005];
        BigInteger[] dua = new BigInteger[5005];
        Arrays.fill(sell, 0);
        Arrays.fill(lastWin, 0);
        Arrays.fill(done, false);

        dua[0] = BigInteger.valueOf(1);
        int i, j;
        for(i = 1; i <= 2500; ++i)
            dua[i] = dua[i-1].multiply(BigInteger.valueOf(2));

        int n = in.nextInt();
        for(i = 1; i <= n; ++i) {
            op[i] = in.next();
            it[i] = in.nextInt();
            if(op[i].equals("sell"))
                sell[it[i]] = i;
        }
        for(i = 1; i <= n; ++i) {
            if(op[i].equals("win"))
                if(i < sell[it[i]])
                    lastWin[it[i]] = i;
        }

        BigInteger ans = BigInteger.valueOf(0);
        for(i = 2000; i >= 0; i--) {
            if(sell[i] > 0 && lastWin[i] > 0) {
                boolean ada = false;
                for(j = lastWin[i]; j <= sell[i]; j++)
                    if(done[j])
                        ada = true;

                if(!ada) {
                    ans = ans.add(dua[i]);
                    for(j = lastWin[i]; j <= sell[i]; j++)
                        done[j] = true;
                }
            }
        }

        out.println(ans);
        out.close();
    }
}

/* Java Template */
class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream), 32768);
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

    public long nextLong() {
        return Long.parseLong(next());
    }
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

public class a {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);

		int n = in.nextInt(), m;
		boolean[] stat = new boolean [2001];
		String s;
		BigInteger ans = new BigInteger("0");
		BigInteger dua[] = new BigInteger[2001];
		dua[0] = new BigInteger("1");

		for(int i = 1; i < 2001; i++)
		dua[i] = dua[i-1].multiply(BigInteger.valueOf(2));

		Arrays.fill(stat,false);

		while (n > 0) {
			s = in.next();
			m = in.nextInt();

			if (s.equals("win"))
				stat[m] = true;
			else {
				if (stat[m]) {
					ans = ans.add( dua[m] );
					Arrays.fill(stat,false);
				}
			}

			n--;
		}

		out.println(ans);
		out.close();
	}
}

/* Java Template */
class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

public class a {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);

		int n = in.nextInt(), m, nquery = 0;
		int [] query = new int[5001];
		boolean[] stat = new boolean [2001];
		String s;
		BigInteger ans = new BigInteger("0");
		BigInteger dua[] = new BigInteger[2001];

		dua[0] = new BigInteger("1");

		for(int i = 1; i < 2001; i++)
		dua[i] = dua[i-1].multiply(BigInteger.valueOf(2));

		Arrays.fill(stat,false);

		while (n > 0) {
			s = in.next();
			m = in.nextInt();

			if (s.equals("win")) {
				if (nquery > 0) {
					Arrays.sort(query,0,nquery);

					int x = query[ nquery-1 ];
					if (stat[x]) {
						ans = ans.add( dua[x] );
						Arrays.fill(stat,false);
						nquery = 0;
					}
				}

				stat[m] = true;
			} else {
				query[ nquery ] = m;
				nquery++;
			}

			n--;
		}

		if (nquery > 0) {
			Arrays.sort(query,0,nquery-1);

			int x = query[ nquery-1 ];
			if (stat[x]) {
				ans = ans.add( dua[x] );
				Arrays.fill(stat,false);
				nquery = 0;
			}
		}

		out.println(ans);
		out.close();
	}
}

/* Java Template */
class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}
}


import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;

public class a {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);

		int n = in.nextInt(), m, nquery = 0;
		int [] query = new int[5001];
		boolean[] stat = new boolean [2001];
		String s;
		BigInteger ans = new BigInteger("0");
		BigInteger dua[] = new BigInteger[2001];

		dua[0] = new BigInteger("1");

		for(int i = 1; i < 2001; i++)
		dua[i] = dua[i-1].multiply(BigInteger.valueOf(2));

		Arrays.fill(stat,false);

		while (n > 0) {
			s = in.next();
			m = in.nextInt();

			if (s.equals("win")) {
				if (nquery > 0) {
					Arrays.sort(query,0,nquery);

					for(int i = nquery - 1; i >= 0; i--) {
						int x = query[i];

						if (stat[x]) {
							//out.println(x);
							ans = ans.add( dua[x] );
							Arrays.fill(stat,false);
							break;
						}
					}

					nquery = 0;
				}

				stat[m] = true;
			} else {
				query[ nquery ] = m;
				nquery++;
			}
			n--;
		}

		if (nquery > 0) {
			Arrays.sort(query,0,nquery);

			for(int i = nquery - 1; i >= 0; i--) {
				int x = query[i];

				if (stat[x]) {
					//out.println(x);
					ans = ans.add( dua[x] );
					Arrays.fill(stat,false);
					nquery = 0;
					break;
				}
			}

			nquery = 0;
		}

		out.println(ans);
		out.close();
	}
}

/* Java Template */
class InputReader {
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream) {
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}
}


#include <cmath>
#include <iostream>
#include <map>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>

using namespace std;

vector < vector <int> > e(2222);

vector <int> sum(vector <int> a, vector <int> b)
{
    int z = 0;
    for (size_t i=0; i<max(a.size(),b.size()) || z; ++i)
    {
        if (i == a.size())
            a.push_back (0);
        a[i] += z + (i < b.size() ? b[i] : 0);
        z = a[i] >= 10;
        if (z)
            a[i] -= 10;
    }
    return a;
}

vector <int> mult(vector <int> a, vector <int> b)
{
    vector <int> c (a.size()+b.size());
    for (size_t i=0; i<a.size(); ++i)
        for (int j=0, z=0; j<(int)b.size() || z; ++j)
        {
            long long cur = c[i+j] + a[i] * 1ll * (j < (int)b.size() ? b[j] : 0) + z;
            c[i+j] = int (cur % 10);
            z = int (cur / 10);
        }
    while (c.size() > 1 && c.back() == 0)
        c.pop_back();
    return c;
}

vector <int> binpow (vector <int> a, int n)
{
    vector <int> f;
    f.push_back(1);
    if (e[n].size() > 0)
        return e[n];
    if (n == 0)
        return e[n] = f;
    if (n % 2 == 1)
        return e[n] = mult(binpow (a, n-1), a);
    else
    {
        vector <int> b = binpow (a, n/2);
        return e[n] = mult(b, b);
    }
}

vector <int> ans, a, met(5005);
vector < vector <int> > w(2010), p(2010);

int main()
{
    //freopen( "input.txt" , "r" , stdin);
    //freopen( "output.txt" , "w" , stdout);
    int n;
    cin >> n;
    int m = 0;
    for (int u = 0; u < n; u++)
    {
        string s;
        cin >> s;
        int c;
        cin >> c;
        if (s == "win")
        {
            w[c].push_back(u);
            if (w[c].size() == 1)
                a.push_back(c);
        }
        else
            p[c].push_back(u);
    }
    sort(a.rbegin(), a.rend());
    for (int i = 0; i < a.size(); i++)
    {
        int c = a[i];
        //cout << "--------" << endl;
        //cout << "c: " << c << endl;
        int m = p[c].size();
        if (m == 0)
            continue;
        int k = w[c].size();
        for (int j = 0; j < m; j++)
        {
            //cout << "sell: " << p[c][j] + 1 << endl;
            int otv = -1;
            for (int e = 0; e < w[c].size(); e++)
            {
                // cout << " win: " << w[c][e] + 1 << endl;
                int f = 0;
                for (int r = w[c][e]; r <= p[c][j]; r++)
                    if (met[r] == 1)
                    {
                        f = 1;
                        break;
                    }
                if (f == 1)
                    continue;
                if (w[c][e] > p[c][j])
                    break;
                otv = w[c][e];
            }
            if (otv == -1)
                continue;
            k--;
            for (int e = otv; e <= p[c][j]; e++)
                met[e] = 1;
            ans.push_back(c);
            if (k == 0)
                break;
        }
        /*for (int j = 0; j < 10; j++)
            cout << met[j] << ' ';
        cout << endl;*/
    }
    int o = 0;
    /*for (int i = 0; i < 10; i++)
        cout << met[i] << ' ';
    cout << endl;*/
    vector <int> ot;
    ot.push_back(0);
    vector <int> q;
    q.push_back(2);
    for (int i = 0; i < ans.size(); i++)
    {
        vector <int> g;
        g = binpow(q, ans[i]);
        ot = sum(g, ot);
    }
    for (int i = ot.size() - 1; i >= 0; i--)
        printf("%d", ot[i]);
    return 0;
}


#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pll pair<long long,long long>
using namespace std;

long long n,x,r[2005],l,sum,tmp,sz;
string s,t[2005],q,answer="0";
bitset<2005>b;
vector<long long>v[2005],ans;
multiset<pll>ms;
multiset<pll>::iterator it;
pll p;
bool f;
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n;
	t[0]="1";
	for(int i=1;i<=2000;i++)
	{
		sum=0;
		for(int j=t[i-1].size()-1;j>=0;j--)
		{
			tmp=(t[i-1][j]-'0')*2+sum;
			if(tmp>=10)
			{
				tmp-=10;
				sum=1;
			}
			else
			{
				sum=0;
			}
			t[i]=(char)(tmp+'0')+t[i];
		}
		if(sum)
		{
			t[i]='1'+t[i];
		}
	}
	for(int i=1;i<=n;i++)
	{
		cin>>s>>x;
		if(s=="sell")
		{
			b[x]=true;
			r[x]=i;
		}
		else if(s=="win"&&!b[x])
		{
			v[x].push_back(i);
		}
	}
	ms.insert(mp(1,n));
	for(int i=2000;i>=0;i--)
	{
		if(v[i].size()&&r[i])
		{
			l=v[i].back(),f=false;
			for(it=ms.begin();it!=ms.end();it++)
			{
				p=*it;
				if(p.fi<=l&&r[i]<=p.se)
				{
					f=true;
					break;
				}
			}
			if(f)
			{
				ms.erase(p);
				ans.push_back(i);
				if(l!=p.fi&&p.fi<l-1)
				{
					ms.insert(mp(p.fi,l-1));
				}
				if(r[i]!=p.se&&p.se>r[i]+1)
				{
					ms.insert(mp(r[i]+1,p.se));
				}
			}
		}
	}
	sort(ans.begin(),ans.end(),greater<long long>());
	for(int i=0;i<ans.size();i++)
	{
		x=ans[i];
		if(!i)
		{
			answer=t[x];
		}
		else
		{
			sz=answer.size()-1,sum=0;
			for(int j=t[x].size()-1;j>=0;j--)
			{
				tmp=(t[x][j]-'0')+(answer[sz]-'0')+sum;
				if(tmp>=10)
				{
					tmp-=10;
					sum=1;
				}
				else
				{
					sum=0;
				}
				answer[sz]=(tmp+'0');
				sz--;
			}
			if(sum)
			{
				while(answer[sz]=='9'&&sz>=0)
				{
					answer[sz]=0;
					sz--;
				}
				if(sz==-1)
				{
					answer='1'+answer;
				}
				else
				{
					answer[sz]++;
				}
			}
		}
	}
	cout<<answer<<'\n';
}


#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pll pair<long long,long long>
using namespace std;

long long n,x,r[2005],l,sum,tmp,sz;
string s,t[2005],q,answer="0";
bitset<2005>b;
vector<long long>v[2005],ans;
multiset<pll>ms;
multiset<pll>::iterator it;
pll p;
bool f;
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin>>n;
	t[0]="1";
	for(int i=1;i<=2000;i++)
	{
		sum=0;
		for(int j=t[i-1].size()-1;j>=0;j--)
		{
			tmp=(t[i-1][j]-'0')*2+sum;
			if(tmp>=10)
			{
				tmp-=10;
				sum=1;
			}
			else
			{
				sum=0;
			}
			t[i]=(char)(tmp+'0')+t[i];
		}
		if(sum)
		{
			t[i]='1'+t[i];
		}
	}
	for(int i=1;i<=n;i++)
	{
		cin>>s>>x;
		if(s=="sell")
		{
			b[x]=true;
			r[x]=i;
		}
		else if(s=="win"&&!b[x])
		{
			v[x].push_back(i);
		}
	}
	ms.insert(mp(1,n));
	for(int i=2000;i>=0;i--)
	{
		if(v[i].size()&&r[i])
		{
			l=v[i].back(),f=false;
			for(it=ms.begin();it!=ms.end();it++)
			{
				p=*it;
				if(p.fi<=l&&r[i]<=p.se)
				{
					f=true;
					break;
				}
			}
			if(f)
			{
				ms.erase(p);
				ans.push_back(i);
				if(l!=p.fi&&p.fi<l-1)
				{
					ms.insert(mp(p.fi,l-1));
				}
				if(r[i]!=p.se&&p.se>r[i]+1)
				{
					ms.insert(mp(r[i]+1,p.se));
				}
			}
		}
	}
	sort(ans.begin(),ans.end(),greater<long long>());
	for(int i=0;i<ans.size();i++)
	{
		x=ans[i];
		if(!i)
		{
			answer=t[x];
		}
		else
		{
			sz=answer.size()-1,sum=0;
			for(int j=t[x].size()-1;j>=0;j--)
			{
				tmp=(t[x][j]-'0')+(answer[sz]-'0')+sum;
				if(tmp>=10)
				{
					tmp-=10;
					sum=1;
				}
				else
				{
					sum=0;
				}
				answer[sz]=(tmp+'0');
				sz--;
			}
			if(sum)
			{
				while(answer[sz]=='9'&&sz>=0)
				{
					answer[sz]='0';
					sz--;
				}
				if(sz==-1)
				{
					answer='1'+answer;
				}
				else
				{
					answer[sz]++;
				}
			}
		}
	}
	cout<<answer<<'\n';
}


#include <bits/stdc++.h>

#define DEBUG(x) cerr << #x << " = " << x << endl

using namespace std;

typedef long long ll;
typedef vector<int> VI;

class BigInt { public:
  const ll BASE = 1000000000;
  VI v;
  int siz, sig;

  // initialization
  BigInt() { v=VI(1,0); siz=sig=1; }
  BigInt(int x) {
    if (x>=0) sig=1;
    else { sig=-1; x*=-1; }
    v=VI(1,x);
    siz=1;
  }
  BigInt(string s) { str2bi(s); }
  BigInt(const BigInt &b) { *this=b; }

  // misc
  void operator=(const BigInt &b) { v=b.v; siz=b.siz; sig=b.sig; }
  int digit(int pos) { if (pos<siz) return v[pos]; return 0; }
  void zero() { v=VI(1,0); siz=sig=1; }
  void resiz(int nsiz, int val=0) { v.resize(siz=nsiz,val); }
  void unzero() {
    int i;
    for (i=siz-1; i>0 && v[i]==0; --i);
    resiz(i+1);
  }
  void str2bi(string s) {
    if (s[0]=='-') { sig=-1; s=s.substr(1); }
    else sig=1;
    reverse(s.begin(),s.end());
    siz=s.size()/9 + 1;
    v=VI(siz,0);
    for (int i=0, pw=1; i<int(s.size()); ++i, pw*=10) {
      if (i%9==0) pw=1;
      v[i/9]+=int(s[i]-'0')*pw;
    }
  }

  // comparisons
  //0: ==b  +: >b  -: <b
  inline int compabs(const BigInt &b) const {
    if (siz!=b.siz) return siz-b.siz;
    for (int i=siz-1; i>=0; --i) {
      if (v[i]!=b.v[i]) return v[i]-b.v[i];
    }
    return 0;
  }
  // 0: ==b  +: >b  -: <b
  inline int compare(const BigInt &b) const {
    if (sig!=b.sig) return sig-b.sig;
    return sig*compabs(b);
  }
  inline bool operator==(const BigInt &b) const { return !compare(b); }
  inline bool operator!=(const BigInt &b) const { return compare(b); }
  inline bool operator<(const BigInt &b) const { return compare(b)<0; }
  inline bool operator<=(const BigInt &b) const { return compare(b)<=0; }
  inline bool operator>(const BigInt &b) const { return compare(b)>0; }
  inline bool operator>=(const BigInt &b) const { return compare(b)>=0; }
  // |x| < 10^9
  inline bool operator==(int x) { return siz==1 && sig*v[0]==x; }

  // operations
  void add(BigInt &b) {
    if (siz<b.siz) resiz(b.siz,0);
    int ca=0;
    for (int i=0; i<siz; ++i) {
      v[i]+=b.digit(i)+ca;
      ca=v[i]/BASE;
      v[i]%=BASE;
    }
    if (ca) resiz(siz+1,ca);
  }
  // assumes that >=b
  void substract(BigInt &b) {
    int ca=0;
    for (int i=0; i<siz; ++i) {
      v[i]+=BASE-b.digit(i)+ca;
      ca=v[i]/BASE-1;
      v[i]%=BASE;
    }
    unzero();
  }

  // operators
  // |x| < 10^9
  void operator+=(int x) {
    v[0]+=x;
    for (int i=0; i<siz && v[i]>=BASE; ++i) {
      v[i+1]+=v[i]/BASE;
      v[i]%=BASE;
    }
    if (v[siz-1]>=BASE) {
      resiz(siz+1,v[siz-1]/BASE);
      v[siz-1]%=BASE;
    }
  }
  void operator+=(BigInt &b) {
    if (sig==b.sig) add(b);
    else if (compabs(b)>=0) substract(b);
    else {
      BigInt aux(b);
      aux.substract(*this);
      *this=aux;
    }
  }
  BigInt operator+(BigInt &x) {
    BigInt ret=*this;
    ret+=x;
    return ret;
  }
  // |x| < 10^9
  void operator-=(int x) {
    v[0]-=x;
    for (int i=0; i<siz && v[i]<0; ++i) {
      v[i+1]+=v[i]/BASE - 1;
      v[i]%=BASE;
      v[i]+=BASE;
    }
    unzero();
  }
  void operator-=(BigInt &b) {
    if (&b==this) zero();
    else {
      b.sig*=-1;
      operator+=(b);
      b.sig*=-1;
    }
  }
  BigInt operator-(BigInt &x) {
    BigInt ret=*this;
    ret-=x;
    return ret;
  }
  // |x| < 10^9
  void operator*=(int x) {
    if (x<0) { sig*=-1; x*=-1; }
    resiz(siz+1,0);
    ll ca=0;
    for (int i=0; i<siz; ++i) {
      ca+=ll(v[i])*ll(x);
      v[i]=ca%BASE;
      ca/=BASE;
    }
    unzero();
  }
  void operator*=(BigInt &b) {
    BigInt c;
    c.resiz(siz + b.siz);
    c.sig=sig*b.sig;
    for (int i=0; i<siz; ++i)
      for (int j=0; j<b.siz; ++j) {
        int k=i+j;
        ll z=ll(digit(i))*ll(b.digit(j)) + c.digit(k);
        for (ll y; (y = z/BASE);) {
          c.v[k]=z%BASE;
          z=y + c.v[++k];
        }
        c.v[k]=z;
      }
    c.unzero();
    *this=c;
  }
  BigInt operator*(BigInt &x) {
    BigInt ret=*this;
    ret*=x;
    return ret;
  }
  // |x| < 10^9
  void operator/=(int x) {
    if (x<0) { sig*=-1; x*=-1; }
    ll ca=0;
    for (int i=siz-1; i>=0; --i) {
      ca+=v[i];
      v[i]=ca/x;
      ca%=x;
      ca*=BASE;
    }
    unzero();
  }
  void operator/=(BigInt &b){
    if (compabs(b)<0) zero();
    else if (b.siz==1) *this/=b.sig*b.v[0];
    else {
      int st=sig*b.sig,sb=b.sig;
      sig=b.sig=1;
      vector<BigInt> VB,pot2;
      VB.push_back(b);
      pot2.push_back(1);
      BigInt cur=0;
      while (VB[VB.size()-1]<=*this){
        BigInt last=VB[VB.size()-1];
        last+=last;
        VB.push_back(last);
        last=pot2[pot2.size()-1];
        last+=last;
        pot2.push_back(last);
      }
      cur+=pot2[pot2.size()-2];
      (*this)-=VB[VB.size()-2];
      while ((*this)>=b){
        int i=0;
        while (VB[i]<=(*this)) ++i;
        cur+=pot2[i-1];
        (*this)-=VB[i-1];
      }
      (*this)=cur;
      sig=st;
      b.sig=sb;
    }
  }
  BigInt operator/(BigInt &x) {
    BigInt ret=*this;
    ret/=x;
    return ret;
  }
  // |x| < 10^9
  ll mod(int x) {
    if (x<0) x*=-1;
    ll ca=0;
    for (int i=siz-1; i>=0; --i) { ca*=BASE; ca+=v[i]; ca%=x; }
    return ca;
  }
  void operator%=(BigInt &b) {
    BigInt r(*this); r/=b; r*=b; operator-=(r);
  }
  void gcdrec(BigInt &b, BigInt &c) {
    if (c==0) return *this=b;
    b%=c;
    gcdrec(c,b);
  }
  void gcd(BigInt &b, BigInt& c) { BigInt bb(b),cc(c); gcdrec(bb,cc); }
  void powrec(BigInt &aux, ll p) {
    if (!p) return;
    powrec(aux,p/2);
    aux*=aux;
    if (p%2) aux*=(*this);
  }
  void pow(ll p) { BigInt aux(1); powrec(aux,p); *this=aux; }

  // input/output
  friend ostream &operator<<(ostream &os, BigInt &x) {
    x.unzero();
    if (x.sig==-1) os << '-';
    int i=x.siz-1;
    os << x.digit(i);
    for (--i; i>=0; --i) {
      os << setw(9) << setfill('0') << x.digit(i);
    }
    return os;
  }
  friend istream &operator >>(istream &is, BigInt &x) {
    string s;
    is >> s;
    x.str2bi(s);
    return is;
  }
};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> win(n, -1);
  vector<pair<int, int> > sell;
  for (int i = 0; i < n; ++i) {
    string s;
    int x;
    cin >> s >> x;
    if (s == "win") win[i] = x;
    else sell.push_back(make_pair(x, i));
  }
  sort(sell.begin(), sell.end());
  BigInt ans = 0;
  vector<char> u(n, 0);
  for (int i = int(sell.size()) - 1; i >= 0; --i) {
    int iw = sell[i].second;
    for (; iw >= 0 && u[iw] == 0 && win[iw] != sell[i].first;) {
      --iw;
    }
    if (iw >= 0 && u[iw] == 0) {
      BigInt p2 = 2;
      p2.pow(sell[i].first);
      ans += p2;
      for (int j = sell[i].second; j >= iw; --j) {
        u[j] = 1;
      }
    }
  }
  cout << ans << endl;
}
//hello


#include <stdio.h>
#include <string>
#include <set>
#define nmax 5010
#define lmax 100010
using namespace std;
int n,i,x,maxx,sol[lmax],lsol=0,curent[lmax];
char s[10]; string ss;
set <int> s1;
inline int max(int a,int b) { if (a>b) return a; else return b; }
void expo()
{
    int a[lmax];
    for (int i=0;i<=curent[0];i++) a[i]=curent[i];
    int r=0;
    for (int i=1;i<=a[0];i++) {
        curent[i]=(a[i]*2+r)%10; r=(a[i]*2+r)/10;
    }
    if (r>0) curent[0]++,curent[curent[0]]=r;
}
void sum(int x)
{
    for (int i=1;i<=sol[0];i++) curent[i]=0;
    curent[1]=curent[0]=1;
    for (int i=1;i<=x;i++) expo();
    int r=0,t;
    for (int i=1;i<=max(curent[0],sol[0]);i++) {
        t=sol[i]; sol[i]=(sol[i]+curent[i]+r)%10;
        r=(t+curent[i]+r)/10;
    }
    sol[0]=max(curent[0],sol[0]);
    if (r>0) sol[0]++,sol[sol[0]]=1;
}
int main() {
scanf("%d",&n); gets(s); sol[0]=1;
for (i=1;i<=n;i++) {
    scanf("%s %d",s,&x); ss=s;
    if (ss=="win") {
        if (maxx>0) sum(maxx),s1.erase(-maxx);
        s1.insert(-x); maxx=*s1.begin();
    } else
    if (ss=="sell" && s1.find(-x)!=s1.end()) maxx=max(maxx,x);
}
if (maxx>0) sum(maxx);
for (i=sol[0];i>=1;i--) printf("%d",sol[i]);
printf("\n");
return 0;
}


#include <stdio.h>
#include <string>
#include <set>
#define nmax 5010
#define lmax 100010
using namespace std;
int n,i,x,maxx,sol[lmax],lsol=0,curent[lmax];
char s[10]; string ss;
set <int> s1;
inline int max(int a,int b) { if (a>b) return a; else return b; }
void expo()
{
    int a[lmax];
    for (int i=0;i<=curent[0];i++) a[i]=curent[i];
    int r=0;
    for (int i=1;i<=a[0];i++) {
        curent[i]=(a[i]*2+r)%10; r=(a[i]*2+r)/10;
    }
    if (r>0) curent[0]++,curent[curent[0]]=r;
}
void sum(int x)
{
    for (int i=1;i<=sol[0];i++) curent[i]=0;
    curent[1]=curent[0]=1;
    for (int i=1;i<=x;i++) expo();
    int r=0,t;
    for (int i=1;i<=max(curent[0],sol[0]);i++) {
        t=sol[i]; sol[i]=(sol[i]+curent[i]+r)%10;
        r=(t+curent[i]+r)/10;
    }
    sol[0]=max(curent[0],sol[0]);
    if (r>0) sol[0]++,sol[sol[0]]=1;
}
int main() {
scanf("%d",&n); gets(s); sol[0]=1;
for (i=1;i<=n;i++) {
    scanf("%s %d",s,&x); ss=s;
    if (ss=="win") {
        printf("%d\n",maxx);
        if (maxx>0) sum(maxx),s1.erase(-maxx);
        s1.insert(-x); maxx=*s1.begin();
    } else
    if (ss=="sell" && s1.find(-x)!=s1.end()) maxx=max(maxx,x);
}
if (maxx>0) sum(maxx);
for (i=sol[0];i>=1;i--) printf("%d",sol[i]);
printf("\n");
return 0;
}


#include <stdio.h>
#include <iostream>
#include <string>
#define nmax 100010
using namespace std;
int n,i,j,x,pos[5010];
char s[10]; string ss,dp[5010];
inline int min(int a,int b) { if (a<b) return a; else return b; }
string max(string a,string b)
{
    int i;
    if (a.size()>b.size()) return a; else
        if (a.size()<b.size()) return b;
    for (i=0;i<a.size() && i<b.size();i++)
        if (a[i]!=b[i]) {
           if (a[i]>b[i]) return a; else
              return b;
        }
}
string expo(int x)
{
    string a="1",sol="1";
    for (int i=1;i<=x;i++) {
        int r=0;
        for (int j=a.size()-1;j>=0;j--) {
            sol[j]=char(((a[j]-48)*2+r)%10+48); r=((a[j]-48)*2+r)/10;
        }
        if (r>0) sol=char(r+48)+sol;
        a=sol;
    }
    return sol;
}
string sum(string a,int x)
{
    string b=expo(x); string c="";
    for (int i=a.size()+1;i<=b.size();i++) a='0'+a;
    for (int i=b.size()+1;i<=a.size();i++) b='0'+b;
    int r=0;
    for (int i=a.size()-1;i>=0;i--) {
        c=char((a[i]+b[i]-96+r)%10+48)+c;
        r=(a[i]+b[i]-96+r)/10;
    }
    if (r>0) c="1"+c;
    return c;
}
int main() {
scanf("%d",&n); gets(s);
for (i=0;i<=n;i++) dp[i]="0";
for (i=1;i<=n;i++) {
    scanf("%s %d",s,&x); ss=s;
    dp[i]=dp[i-1];
    if (ss=="win") pos[x]=i;
    if (ss=="sell" && pos[x]!=0) dp[i]=max(dp[i],sum(dp[pos[x]],x));
}
cout<<dp[n];
return 0;
}


#include <stdio.h>
#include <string>
#include <set>
#define nmax 5010
#define lmax 100010
using namespace std;
int n,i,x,dp[nmax],maxx,sol[lmax],lsol=0,curent[lmax];
char s[10]; string ss;
set <int> s1;
inline int max(int a,int b) { if (a>b) return a; else return b; }
void expo()
{
    int a[lmax];
    for (int i=0;i<=curent[0];i++) a[i]=curent[i];
    int r=0;
    for (int i=1;i<=a[0];i++) {
        curent[i]=(a[i]*2+r)%10; r=(a[i]*2+r)/10;
    }
    if (r>0) curent[0]++,curent[curent[0]]=r;
}
void sum(int x)
{
    for (int i=1;i<=sol[0];i++) curent[i]=0;
    curent[1]=curent[0]=1;
    for (int i=1;i<=x;i++) expo();
    int r=0,t;
    for (int i=1;i<=max(curent[0],sol[0]);i++) {
        t=sol[i]; sol[i]=(sol[i]+curent[i]+r)%10;
        r=(t+curent[i]+r)/10;
    }
    sol[0]=max(curent[0],sol[0]);
    if (r>0) sol[0]++,sol[sol[0]]=1;
}
int main() {
scanf("%d",&n); gets(s); sol[0]=1;
for (i=1;i<=n;i++) {
    scanf("%s %d",s,&x); ss=s;
    if (ss=="win") {
        if (maxx>0) sum(maxx),s1.clear();
        s1.insert(-x); maxx=0;
    } else
    if (ss=="sell" && s1.find(-x)!=s1.end()) maxx=max(maxx,x);
}
if (maxx>0) sum(maxx);
for (i=sol[0];i>=1;i--) printf("%d",sol[i]);
printf("\n");
return 0;
}


#include <stdio.h>
#include <iostream>
#include <string>
#define nmax 100010
using namespace std;
int n,i,j,x,pos[5010];
char s[10]; string ss,dp[5010],put2[2002];
inline int min(int a,int b) { if (a<b) return a; else return b; }
string max(string a,string b)
{
    int i;
    if (a.size()>b.size()) return a; else
        if (a.size()<b.size()) return b;
    for (i=0;i<a.size() && i<b.size();i++)
        if (a[i]!=b[i]) {
           if (a[i]>b[i]) return a; else
              return b;
        }
}
string expo(int x)
{
    string a="1",sol="1"; put2[0]="1";
    for (int i=1;i<=x;i++) {
        int r=0;
        for (int j=a.size()-1;j>=0;j--) {
            sol[j]=char(((a[j]-48)*2+r)%10+48); r=((a[j]-48)*2+r)/10;
        }
        if (r>0) sol=char(r+48)+sol; put2[i]=sol;
        a=sol;
    }
    return sol;
}
string sum(string a,int x)
{
    string b=put2[x]; string c="";
    for (int i=a.size()+1;i<=b.size();i++) a='0'+a;
    for (int i=b.size()+1;i<=a.size();i++) b='0'+b;
    int r=0;
    for (int i=a.size()-1;i>=0;i--) {
        c=char((a[i]+b[i]-96+r)%10+48)+c;
        r=(a[i]+b[i]-96+r)/10;
    }
    if (r>0) c="1"+c;
    return c;
}
int main() {
scanf("%d",&n); gets(s);
expo(2000);
for (i=0;i<=n;i++) dp[i]="0";
for (i=1;i<=n;i++) {
    scanf("%s %d",s,&x); ss=s;
    dp[i]=dp[i-1];
    if (ss=="win") pos[x]=i;
    if (ss=="sell" && pos[x]!=0) dp[i]=max(dp[i],sum(dp[pos[x]],x));
}
cout<<dp[n]<<'\n';
return 0;
}


#include <stdio.h>
#include <string>
#include <set>
#define nmax 5010
using namespace std;
int n,i,x,dp[nmax],maxx;
long long sol=0;
char s[10]; string ss;
set <int> s1;
inline int max(int a,int b) { if (a>b) return a; else return b; }
int main() {
scanf("%d",&n); gets(s);
for (i=1;i<=n;i++) {
    scanf("%s %d",s,&x); ss=s;
    if (ss=="win") {
        if (maxx>0) sol=sol+(1<<maxx),s1.clear();
        s1.insert(-x); maxx=0;
    } else
    if (ss=="sell" && s1.find(-x)!=s1.end()) maxx=max(maxx,x);
}
if (maxx>0) sol=sol+(1<<maxx);
printf("%I64d",sol);
return 0;
}


#include <stdio.h>
#include <iostream>
#include <string>
#define nmax 100010
using namespace std;
int n,i,j,x,pos[5010];
char s[10]; string ss,dp[5010],put2[2002];
inline int min(int a,int b) { if (a<b) return a; else return b; }
string max(string a,string b)
{
    int i;
    if (a.size()>b.size()) return a; else
        if (a.size()<b.size()) return b;
    for (i=0;i<a.size() && i<b.size();i++)
        if (a[i]!=b[i]) {
           if (a[i]>b[i]) return a; else
              return b;
        }
}
string expo(int x)
{
    string a="1",sol="1"; put2[0]="1";
    for (int i=1;i<=x;i++) {
        int r=0;
        for (int j=a.size()-1;j>=0;j--) {
            sol[j]=char(((a[j]-48)*2+r)%10+48); r=((a[j]-48)*2+r)/10;
        }
        if (r>0) sol=char(r+48)+sol; put2[i]=sol;
        a=sol;
    }
    return sol;
}
string sum(string a,int x)
{
    string b=put2[x]; string c="";
    for (int i=a.size()+1;i<=b.size();i++) a='0'+a;
    for (int i=b.size()+1;i<=a.size();i++) b='0'+b;
    int r=0;
    for (int i=a.size()-1;i>=0;i--) {
        c=char((a[i]+b[i]-96+r)%10+48)+c;
        r=(a[i]+b[i]-96+r)/10;
    }
    if (r>0) c="1"+c;
    return c;
}
int main() {
scanf("%d",&n); gets(s);
expo(2000);
for (i=1;i<=n;i++) {
    scanf("%s %d",s,&x); ss=s;
    dp[i]=dp[i-1];
    if (ss=="win") pos[x]=i;
    if (ss=="sell" && pos[x]!=0) dp[i]=max(dp[i],sum(dp[pos[x]],x));
}
cout<<dp[n]<<'\n';
return 0;
}


#include <stdio.h>
#include <string>
#include <set>
#define nmax 5010
#define lmax 100010
using namespace std;
int n,i,x,dp[nmax],maxx,sol[lmax],lsol=0,curent[lmax];
char s[10]; string ss;
set <int> s1;
inline int max(int a,int b) { if (a>b) return a; else return b; }
void expo()
{
    int a[lmax];
    for (int i=0;i<=curent[0];i++) a[i]=curent[i];
    int r=0;
    for (int i=1;i<=a[0];i++) {
        curent[i]=(a[i]*2+r)%10; r=(a[i]*2+r)/10;
    }
    if (r>0) curent[0]++,curent[curent[0]]=r;
}
void sum(int x)
{
    curent[1]=curent[0]=1;
    for (i=1;i<=x;i++) expo();
    int r=0,t;
    for (i=1;i<=max(curent[0],sol[0]);i++) {
        t=sol[i]; sol[i]=(sol[i]+curent[i]+r)%10;
        r=(t+curent[i]+r)/10;
    }
    sol[0]=max(curent[0],sol[0]);
    if (r>0) sol[0]++,sol[sol[0]]=1;
}
int main() {
scanf("%d",&n); gets(s); sol[0]=1;
for (i=1;i<=n;i++) {
    scanf("%s %d",s,&x); ss=s;
    if (ss=="win") {
        if (maxx>0) sum(maxx),s1.clear();
        s1.insert(-x); maxx=0;
    } else
    if (ss=="sell" && s1.find(-x)!=s1.end()) maxx=max(maxx,x);
}
if (maxx>0) sum(maxx);
for (i=sol[0];i>=1;i--) printf("%d",sol[i]);
printf("\n");
return 0;
}


#include <stdio.h>
#include <iostream>
#include <string>
#define nmax 100010
using namespace std;
int n,i,j,x,t[5010],pos[5010];
char s[10]; string ss[5010],dp[5010];
inline int min(int a,int b) { if (a<b) return a; else return b; }
string max(string a,string b)
{
    int i;
    for (i=0;i<min(a.size(),b.size());i++)
        if (a[i]!=b[i]) break;
    if (i<min(a.size(),b.size())) {
        if (a[i]>b[i]) return a; else
            return b;
    }
    if (a.size()>b.size()) return a; else
       return b;
}
string expo(int x)
{
    string a="1",sol="1";
    for (int i=1;i<=x;i++) {
        int r=0;
        for (int j=a.size()-1;j>=0;j--) {
            sol[j]=char(((a[j]-48)*2+r)%10+48); r=((a[j]-48)*2+r)/10;
        }
        if (r>0) sol=char(r+48)+sol;
        a=sol;
    }
    return sol;
}
string sum(string a,int x)
{
    string b=expo(x); string c="";
    for (int i=a.size()+1;i<=b.size();i++) a='0'+a;
    for (int i=b.size()+1;i<=a.size();i++) b='0'+b;
    int r=0;
    for (int i=a.size()-1;i>=0;i--) {
        c=char((a[i]+b[i]-96+r)%10+48)+c;
        r=(a[i]+b[i]-96+r)/10;
    }
    if (r>0) c="1"+c;
    return c;
}
int main() {
//freopen("1.in","r",stdin);
scanf("%d",&n); gets(s);
for (i=0;i<=n;i++) dp[i]="0";
for (i=1;i<=n;i++) {
    scanf("%s %d",s,&x); ss[i]=s; t[i]=x; gets(s);
    dp[i]=dp[i-1];
    if (ss[i]=="win") pos[x]=i;
    if (ss[i]=="sell" && pos[x]!=0) dp[i]=max(dp[i],sum(dp[pos[x]],x));
}
cout<<dp[n];
return 0;
}


#include <stdio.h>
#include <iostream>
#include <string>
#define nmax 100010
using namespace std;
int n,i,j,x,t[5010],pos[5010];
char s[10]; string ss[5010],dp[5010];
inline int min(int a,int b) { if (a<b) return a; else return b; }
string max(string a,string b)
{
    int i;
    if (a.size()>b.size()) return a; else
        if (a.size()<b.size()) return b;
    for (i=0;i<a.size() && i<b.size();i++)
        if (a[i]!=b[i]) {
           if (a[i]>b[i]) return a; else
              return b;
        }
}
string expo(int x)
{
    string a="1",sol="1";
    for (int i=1;i<=x;i++) {
        int r=0;
        for (int j=a.size()-1;j>=0;j--) {
            sol[j]=char(((a[j]-48)*2+r)%10+48); r=((a[j]-48)*2+r)/10;
        }
        if (r>0) sol=char(r+48)+sol;
        a=sol;
    }
    return sol;
}
string sum(string a,int x)
{
    string b=expo(x); string c="";
    for (int i=a.size()+1;i<=b.size();i++) a='0'+a;
    for (int i=b.size()+1;i<=a.size();i++) b='0'+b;
    int r=0;
    for (int i=a.size()-1;i>=0;i--) {
        c=char((a[i]+b[i]-96+r)%10+48)+c;
        r=(a[i]+b[i]-96+r)/10;
    }
    if (r>0) c="1"+c;
    return c;
}
int main() {
scanf("%d",&n); gets(s);
for (i=0;i<=n;i++) dp[i]="0";
for (i=1;i<=n;i++) {
    scanf("%s %d",s,&x); ss[i]=s; t[i]=x; gets(s);
    dp[i]=dp[i-1];
    if (ss[i]=="win") pos[x]=i;
    if (ss[i]=="sell" && pos[x]!=0) dp[i]=max(dp[i],sum(dp[pos[x]],x));
}
cout<<dp[n];
return 0;
}


#include <stdio.h>
#include <string>
#include <set>
#define nmax 5010
#define lmax 100010
using namespace std;
int n,i,x,dp[nmax],maxx,sol[lmax],lsol=0,curent[lmax];
char s[10]; string ss;
set <int> s1;
inline int max(int a,int b) { if (a>b) return a; else return b; }
void expo()
{
    int a[lmax];
    for (int i=0;i<=curent[0];i++) a[i]=curent[i];
    int r=0;
    for (int i=1;i<=a[0];i++) {
        curent[i]=(a[i]*2+r)%10; r=(a[i]*2+r)/10;
    }
    if (r>0) curent[0]++,curent[curent[0]]=r;
}
void sum(int x)
{
    curent[1]=curent[0]=1;
    for (i=1;i<=x;i++) expo();
    int r=0,t;
    for (i=1;i<=max(curent[0],sol[0]);i++) {
        t=sol[i]; sol[i]=(sol[i]+curent[i]+r)%10;
        r=(t+curent[i]+r)/10;
    }
    sol[0]=max(curent[0],sol[0]);
    if (r>0) sol[0]++,sol[sol[0]]=1;
}
int main() {
freopen("1.in","r",stdin);
scanf("%d",&n); gets(s); sol[0]=1;
for (i=1;i<=n;i++) {
    scanf("%s %d",s,&x); ss=s;
    if (ss=="win") {
        if (maxx>0) sum(maxx),s1.clear();
        s1.insert(-x); maxx=0;
    } else
    if (ss=="sell" && s1.find(-x)!=s1.end()) maxx=max(maxx,x);
}
if (maxx>0) sum(maxx);
for (i=sol[0];i>=1;i--) printf("%d",sol[i]);
printf("\n");
return 0;
}


#include <stdio.h>
#include <iostream>
#include <string>
#define nmax 100010
using namespace std;
int n,i,j,x,pos[5010];
char s[10]; string ss,dp[5010],put2[2002];
inline int min(int a,int b) { if (a<b) return a; else return b; }
string max(string a,string b)
{
    int i;
    if (a.size()>b.size()) return a; else
        if (a.size()<b.size()) return b;
    for (i=0;i<a.size() && i<b.size();i++)
        if (a[i]!=b[i]) {
           if (a[i]>b[i]) return a; else
              return b;
        }
}
string expo(int x)
{
    string a="1",sol="1"; put2[0]="1";
    for (int i=1;i<=x;i++) {
        int r=0;
        for (int j=a.size()-1;j>=0;j--) {
            sol[j]=char(((a[j]-48)*2+r)%10+48); r=((a[j]-48)*2+r)/10;
        }
        if (r>0) sol=char(r+48)+sol; put2[i]=sol;
        a=sol;
    }
    return sol;
}
string sum(string a,int x)
{
    string b=put2[x]; string c="";
    for (int i=a.size()+1;i<=b.size();i++) a='0'+a;
    for (int i=b.size()+1;i<=a.size();i++) b='0'+b;
    int r=0;
    for (int i=a.size()-1;i>=0;i--) {
        c=char((a[i]+b[i]-96+r)%10+48)+c;
        r=(a[i]+b[i]-96+r)/10;
    }
    if (r>0) c="1"+c;
    return c;
}
int main() {
scanf("%d",&n); gets(s);
expo(2000);
for (i=1;i<=n;i++) {
    scanf("%s %d",s,&x); ss=s;
    dp[i]=dp[i-1];
    if (ss=="win") pos[x]=i;
    if (ss=="sell" && pos[x]!=0) dp[i]=max(dp[i],sum(dp[pos[x]],x));
}
cout<<dp[n];
return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000;
struct bign{
    int d[maxn], len;

    void clean() { while(len > 1 && !d[len-1]) len--; }

    bign()          { memset(d, 0, sizeof(d)); len = 1; }
    bign(int num)   { *this = num; }
    bign(char* num) { *this = num; }
    bign operator = (const char* num){
        memset(d, 0, sizeof(d)); len = strlen(num);
        for(int i = 0; i < len; i++) d[i] = num[len-1-i] - '0';
        clean();
        return *this;
    }
    bign operator = (int num){
        char s[20]; sprintf(s, "%d", num);
        *this = s;
        return *this;
    }

    bign operator + (const bign& b){
        bign c = *this; int i;
        for (i = 0; i < b.len; i++){
            c.d[i] += b.d[i];
            if (c.d[i] > 9) c.d[i]%=10, c.d[i+1]++;
        }
        while (c.d[i] > 9) c.d[i++]%=10, c.d[i]++;
        c.len = max(len, b.len);
        if (c.d[i] && c.len <= i) c.len = i+1;
        return c;
    }
    bign operator - (const bign& b){
        bign c = *this; int i;
        for (i = 0; i < b.len; i++){
            c.d[i] -= b.d[i];
            if (c.d[i] < 0) c.d[i]+=10, c.d[i+1]--;
        }
        while (c.d[i] < 0) c.d[i++]+=10, c.d[i]--;
        c.clean();
        return c;
    }
    bign operator * (const bign& b)const{
        int i, j; bign c; c.len = len + b.len;
        for(j = 0; j < b.len; j++) for(i = 0; i < len; i++)
            c.d[i+j] += d[i] * b.d[j];
        for(i = 0; i < c.len-1; i++)
            c.d[i+1] += c.d[i]/10, c.d[i] %= 10;
        c.clean();
        return c;
    }
    bign operator / (const bign& b){
        int i, j;
        bign c = *this, a = 0;
        for (i = len - 1; i >= 0; i--)
        {
            a = a*10 + d[i];
            for (j = 0; j < 10; j++) if (a < b*(j+1)) break;
            c.d[i] = j;
            a = a - b*j;
        }
        c.clean();
        return c;
    }
    bign operator % (const bign& b){
        int i, j;
        bign a = 0;
        for (i = len - 1; i >= 0; i--)
        {
            a = a*10 + d[i];
            for (j = 0; j < 10; j++) if (a < b*(j+1)) break;
            a = a - b*j;
        }
        return a;
    }
    bign operator += (const bign& b){
        *this = *this + b;
        return *this;
    }

    bool operator <(const bign& b) const{
        if(len != b.len) return len < b.len;
        for(int i = len-1; i >= 0; i--)
            if(d[i] != b.d[i]) return d[i] < b.d[i];
        return false;
    }
    bool operator >(const bign& b) const{return b < *this;}
    bool operator<=(const bign& b) const{return !(b < *this);}
    bool operator>=(const bign& b) const{return !(*this < b);}
    bool operator!=(const bign& b) const{return b < *this || *this < b;}
    bool operator==(const bign& b) const{return !(b < *this) && !(b > *this);}

    string str() const{
        char s[maxn]={};
        for(int i = 0; i < len; i++) s[len-1-i] = d[i]+'0';
        return s;
    }
};
const int N=5050;
bign dp[N],pw[2020];
int last[N];
int main(){
    pw[0]=1;
    for(int i=1;i<=2000;i++)pw[i]=pw[i-1]*2;
    int n,x;
    char op[10];
    scanf("%d",&n);
    bign ans=0;
    for(int i=1;i<=n;i++){
        scanf("%s %d",op,&x);
        dp[i]=dp[i-1];
        if(op[0]=='w'){
            last[x]=i;
        }else{
            if(!last[x])continue;
            bign tmp=dp[last[x]]+pw[x];
            if(dp[i]<tmp)dp[i]=tmp;
        }
        if(ans<dp[i])ans=dp[i];
    }
    cout<<ans.str()<<endl;
}


// Pushkar Singh AKA stud_ious
// Yellow Flash of India
// Hokage!

#include <bits/stdc++.h>
using namespace std;
#define ll long long
// Useful constants
#define INF (int)2e9
#define INFL (long long)1e18
#define EPS 1e-9
// Useful hardware instructions
#define bitcount __builtin_popcount
#define gcd __gcd
// Useful container manipulation / traversal macros
#define all(a) a.begin(), a.end()
#define in(a,b) ( (b).find(a) != (b).end())
#define pb push_back
#define fill(a,v) memset(a, v, sizeof a)// fill originally
#define mp make_pair

// Input macros
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%lld",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)

#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) typeof(v) r = (v)
#endif
#define tr(container, it) for(aut(it,container.begin()); it != container.end(); it++)

#define llu long long unsigned
#define ld long

#define DEBUG 1
#define debug(x) {if (DEBUG)cout <<#x <<" = " <<x <<endl; }
#define debugv(x) {if (DEBUG) {cout <<#x <<" = "; tr((x),it) cout <<*it <<", "; cout <<endl; }}

#define checkbit(n,b) ( (n >> b) & 1)
#define setbit(n,b) (n | ((1 << b)))
#define unsetbit(n,b) (n & (~(1 << b)))
#define rep(i,n) for(ll i=0; i<(ll)n;i++)
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define mod (1000000007LL)

//typedef pair<ll,pair<ll,pair<ll,ll> > >  pp;

//freopen (fname"in","r",stdin);
//freopen (fname"out","w",stdout);
/*
	freopen("C-small-attempt0.in", "r", stdin);
		freopen("cout.txt", "w", stdout);
 */

int n,m;
int t;

const int base = 1000000000;
const int base_digits = 9;

struct bigint {
    vector<int> a;
    int sign;

    bigint() :
        sign(1) {
    }

    bigint(long long v) {
        *this = v;
    }

    bigint(const string &s) {
        read(s);
    }

    void operator=(const bigint &v) {
        sign = v.sign;
        a = v.a;
    }

    void operator=(long long v) {
        sign = 1;
        if (v < 0)
            sign = -1, v = -v;
        for (; v > 0; v = v / base)
            a.push_back(v % base);
    }

    bigint operator+(const bigint &v) const {
        if (sign == v.sign) {
            bigint res = v;

            for (int i = 0, carry = 0; i < (int) max(a.size(), v.a.size()) || carry; ++i) {
                if (i == (int) res.a.size())
                    res.a.push_back(0);
                res.a[i] += carry + (i < (int) a.size() ? a[i] : 0);
                carry = res.a[i] >= base;
                if (carry)
                    res.a[i] -= base;
            }
            return res;
        }
        return *this - (-v);
    }

    bigint operator-(const bigint &v) const {
        if (sign == v.sign) {
            if (abs() >= v.abs()) {
                bigint res = *this;
                for (int i = 0, carry = 0; i < (int) v.a.size() || carry; ++i) {
                    res.a[i] -= carry + (i < (int) v.a.size() ? v.a[i] : 0);
                    carry = res.a[i] < 0;
                    if (carry)
                        res.a[i] += base;
                }
                res.trim();
                return res;
            }
            return -(v - *this);
        }
        return *this + (-v);
    }

    void operator*=(int v) {
        if (v < 0)
            sign = -sign, v = -v;
        for (int i = 0, carry = 0; i < (int) a.size() || carry; ++i) {
            if (i == (int) a.size())
                a.push_back(0);
            long long cur = a[i] * (long long) v + carry;
            carry = (int) (cur / base);
            a[i] = (int) (cur % base);
            //asm("divl %%ecx" : "=a"(carry), "=d"(a[i]) : "A"(cur), "c"(base));
        }
        trim();
    }

    bigint operator*(int v) const {
        bigint res = *this;
        res *= v;
        return res;
    }

    friend pair<bigint, bigint> divmod(const bigint &a1, const bigint &b1) {
        int norm = base / (b1.a.back() + 1);
        bigint a = a1.abs() * norm;
        bigint b = b1.abs() * norm;
        bigint q, r;
        q.a.resize(a.a.size());

        for (int i = a.a.size() - 1; i >= 0; i--) {
            r *= base;
            r += a.a[i];
            int s1 = r.a.size() <= b.a.size() ? 0 : r.a[b.a.size()];
            int s2 = r.a.size() <= b.a.size() - 1 ? 0 : r.a[b.a.size() - 1];
            int d = ((long long) base * s1 + s2) / b.a.back();
            r -= b * d;
            while (r < 0)
                r += b, --d;
            q.a[i] = d;
        }

        q.sign = a1.sign * b1.sign;
        r.sign = a1.sign;
        q.trim();
        r.trim();
        return make_pair(q, r / norm);
    }

    bigint operator/(const bigint &v) const {
        return divmod(*this, v).first;
    }

    bigint operator%(const bigint &v) const {
        return divmod(*this, v).second;
    }

    void operator/=(int v) {
        if (v < 0)
            sign = -sign, v = -v;
        for (int i = (int) a.size() - 1, rem = 0; i >= 0; --i) {
            long long cur = a[i] + rem * (long long) base;
            a[i] = (int) (cur / v);
            rem = (int) (cur % v);
        }
        trim();
    }

    bigint operator/(int v) const {
        bigint res = *this;
        res /= v;
        return res;
    }

    int operator%(int v) const {
        if (v < 0)
            v = -v;
        int m = 0;
        for (int i = a.size() - 1; i >= 0; --i)
            m = (a[i] + m * (long long) base) % v;
        return m * sign;
    }

    void operator+=(const bigint &v) {
        *this = *this + v;
    }
    void operator-=(const bigint &v) {
        *this = *this - v;
    }
    void operator*=(const bigint &v) {
        *this = *this * v;
    }
    void operator/=(const bigint &v) {
        *this = *this / v;
    }

    bool operator<(const bigint &v) const {
        if (sign != v.sign)
            return sign < v.sign;
        if (a.size() != v.a.size())
            return a.size() * sign < v.a.size() * v.sign;
        for (int i = a.size() - 1; i >= 0; i--)
            if (a[i] != v.a[i])
                return a[i] * sign < v.a[i] * sign;
        return false;
    }

    bool operator>(const bigint &v) const {
        return v < *this;
    }
    bool operator<=(const bigint &v) const {
        return !(v < *this);
    }
    bool operator>=(const bigint &v) const {
        return !(*this < v);
    }
    bool operator==(const bigint &v) const {
        return !(*this < v) && !(v < *this);
    }
    bool operator!=(const bigint &v) const {
        return *this < v || v < *this;
    }

    void trim() {
        while (!a.empty() && !a.back())
            a.pop_back();
        if (a.empty())
            sign = 1;
    }

    bool isZero() const {
        return a.empty() || (a.size() == 1 && !a[0]);
    }

    bigint operator-() const {
        bigint res = *this;
        res.sign = -sign;
        return res;
    }

    bigint abs() const {
        bigint res = *this;
        res.sign *= res.sign;
        return res;
    }

    long long longValue() const {
        long long res = 0;
        for (int i = a.size() - 1; i >= 0; i--)
            res = res * base + a[i];
        return res * sign;
    }

    friend bigint gcd(const bigint &a, const bigint &b) {
        return b.isZero() ? a : gcd(b, a % b);
    }
    friend bigint lcm(const bigint &a, const bigint &b) {
        return a / gcd(a, b) * b;
    }

    void read(const string &s) {
        sign = 1;
        a.clear();
        int pos = 0;
        while (pos < (int) s.size() && (s[pos] == '-' || s[pos] == '+')) {
            if (s[pos] == '-')
                sign = -sign;
            ++pos;
        }
        for (int i = s.size() - 1; i >= pos; i -= base_digits) {
            int x = 0;
            for (int j = max(pos, i - base_digits + 1); j <= i; j++)
                x = x * 10 + s[j] - '0';
            a.push_back(x);
        }
        trim();
    }

    friend istream& operator>>(istream &stream, bigint &v) {
        string s;
        stream >> s;
        v.read(s);
        return stream;
    }

    friend ostream& operator<<(ostream &stream, const bigint &v) {
        if (v.sign == -1)
            stream << '-';
        stream << (v.a.empty() ? 0 : v.a.back());
        for (int i = (int) v.a.size() - 2; i >= 0; --i)
            stream << setw(base_digits) << setfill('0') << v.a[i];
        return stream;
    }

    static vector<int> convert_base(const vector<int> &a, int old_digits, int new_digits) {
        vector<long long> p(max(old_digits, new_digits) + 1);
        p[0] = 1;
        for (int i = 1; i < (int) p.size(); i++)
            p[i] = p[i - 1] * 10;
        vector<int> res;
        long long cur = 0;
        int cur_digits = 0;
        for (int i = 0; i < (int) a.size(); i++) {
            cur += a[i] * p[cur_digits];
            cur_digits += old_digits;
            while (cur_digits >= new_digits) {
                res.push_back(int(cur % p[new_digits]));
                cur /= p[new_digits];
                cur_digits -= new_digits;
            }
        }
        res.push_back((int) cur);
        while (!res.empty() && !res.back())
            res.pop_back();
        return res;
    }

    typedef vector<long long> vll;

    static vll karatsubaMultiply(const vll &a, const vll &b) {
        int n = a.size();
        vll res(n + n);
        if (n <= 32) {
            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++)
                    res[i + j] += a[i] * b[j];
            return res;
        }

        int k = n >> 1;
        vll a1(a.begin(), a.begin() + k);
        vll a2(a.begin() + k, a.end());
        vll b1(b.begin(), b.begin() + k);
        vll b2(b.begin() + k, b.end());

        vll a1b1 = karatsubaMultiply(a1, b1);
        vll a2b2 = karatsubaMultiply(a2, b2);

        for (int i = 0; i < k; i++)
            a2[i] += a1[i];
        for (int i = 0; i < k; i++)
            b2[i] += b1[i];

        vll r = karatsubaMultiply(a2, b2);
        for (int i = 0; i < (int) a1b1.size(); i++)
            r[i] -= a1b1[i];
        for (int i = 0; i < (int) a2b2.size(); i++)
            r[i] -= a2b2[i];

        for (int i = 0; i < (int) r.size(); i++)
            res[i + k] += r[i];
        for (int i = 0; i < (int) a1b1.size(); i++)
            res[i] += a1b1[i];
        for (int i = 0; i < (int) a2b2.size(); i++)
            res[i + n] += a2b2[i];
        return res;
    }

    bigint operator*(const bigint &v) const {
        vector<int> a6 = convert_base(this->a, base_digits, 6);
        vector<int> b6 = convert_base(v.a, base_digits, 6);
        vll a(a6.begin(), a6.end());
        vll b(b6.begin(), b6.end());
        while (a.size() < b.size())
            a.push_back(0);
        while (b.size() < a.size())
            b.push_back(0);
        while (a.size() & (a.size() - 1))
            a.push_back(0), b.push_back(0);
        vll c = karatsubaMultiply(a, b);
        bigint res;
        res.sign = sign * v.sign;
        for (int i = 0, carry = 0; i < (int) c.size(); i++) {
            long long cur = c[i] + carry;
            res.a.push_back((int) (cur % 1000000));
            carry = (int) (cur / 1000000);
        }
        res.a = convert_base(res.a, 6, base_digits);
        res.trim();
        return res;
    }
};

bigint pow2[2009], dp[5009][2];
int lastt[2009];
int main()
{
    bigint a = bigint("1");
    int b = 2;
    pow2[0]=a;
    for(int i=1; i<=2000; i++)
    {
        a = a*b;
        pow2[i]=a;
    }

   // cout << a << endl;

fill(lastt,-1);

    s(n);
    string op;
    int in;
    rep(i,n)
    {
    	cin>>op>>in;

    	if(i==0)
    	{
    		dp[i][0]= bigint(0);dp[i][1] = bigint(0);
    	}
    	else if((lastt[in]==-1 || op == "win"))
    	{
    		dp[i][0] = max(dp[i-1][0],dp[i-1][1]);dp[i][1] = bigint(0);
    	}
    	else
    	{
    		if(lastt[in] > 0)
    		{
    			dp[i][1] = max(dp[lastt[in]-1][0],dp[lastt[in]-1][1]);
    			dp[i][1] = dp[i][1] + pow2[in];
    			dp[i][0] = max(dp[i-1][0],dp[i-1][1]);
    		}
    		else
    		{
    			dp[i][1] =  pow2[in];
    			dp[i][0] = max(dp[i-1][0],dp[i-1][1]);
    		}
    	}

    	if(op=="win")
    	{
    		lastt[in]=i;
    	}

    }

    cout<<max(dp[n-1][1],dp[n-1][0])<<endl;

}


#include <iostream>
//#include <set>
#include <string>

using namespace std;

/*
struct Item
{
	int index;
	int type;
	int x;

	bool operator < (const Item &other) const
	{
		return index < other.index;
	}
};*/

const int N = 2001;

int index[N][2];
bool used[5002];
int best[N];
int exp2[N];
int len1;
int ans[N];
int len2;

void add(int a[], int &lenA, int b[], int lenB)
{
	int i, r, c, end;
	end = max(lenA, lenB);

	for (i = 0, r = 0, c = 0; i <= end; i++)
	{
		r = (a[i] + b[i] + c) % 10;
		c = (a[i] + b[i] + c) / 10;
		a[i] = r;
	}

	if (c)
	{
		a[i] = c;
		lenA = i + 1;
	}
	else
	{
		lenA = i;
	}
}

void ax2(int a[], int &lenA)
{
	int i, r, c;

	for (i = 0, r = 0, c = 0; i < lenA; i++)
	{
		r = (a[i] * 2 + c) % 10;
		c = (a[i] * 2 + c) / 10;
		a[i] = r;
	}

	if (c)
	{
		a[i] = c;
		lenA = i + 1;
	}
	else
	{
		lenA = i;
	}
}

int main()
{
	int n, i, x;
	string type;
	int index1, index2;

	cin >> n;

	for (i = 1; i <= n; i++)
	{
		cin >> type;
		cin >> x;

		if (type == "sell")
		{
			index[x][1] = i;
		}
		else if (index[x][1] == 0)
		{
			index[x][0] = i;
		}
	}

	bool ok;
	for (x = N - 2; x >= 0; x--)
	{
		if (index[x][0] && index[x][1] && index[x][0] < index[x][1])
		{
			index1 = index[x][0];
			index2 = index[x][1];

			ok = true;
			for (i = index1; i <= index2; i++)
			{
				if (used[i])
				{
					ok = false;
					break;
				}
			}

			if (ok)
			{
				best[x] = 1;
				for (i = index1; i <= index2; i++)
				{
					used[i] = true;
				}
			}
		}
	}

	exp2[0] = 1;
	len1 = 1;
	len2 = 1;
	for (i = 0; i < N - 4; i++)
	{
		if (best[i])
		{
			add(ans, len1, exp2, len2);
		}
		ax2(exp2, len2);
	}

	for (i = len1 - 1; i > 0 && ans[len1 - 1] == 0; i--)
	{
		len1--;
	}
	for (i = len1 - 1; i >= 0; i--)
	{
		cout << ans[i];
	}
	cout << endl;

	return 0;
}


#include <iostream>
//#include <set>
#include <string>

using namespace std;

/*
struct Item
{
	int index;
	int type;
	int x;

	bool operator < (const Item &other) const
	{
		return index < other.index;
	}
};*/

const int N = 2001;

int index[N][2];
bool used[5002];
int best[N];
int exp2[N];
int len1;
int ans[N];
int len2;

void add(int a[], int &lenA, int b[], int lenB)
{
	int i, r, c, end;
	end = max(lenA, lenB);

	for (i = 0, r = 0, c = 0; i <= end; i++)
	{
		r = (a[i] + b[i] + c) % 10;
		c = (a[i] + b[i] + c) / 10;
		a[i] = r;
	}

	if (c)
	{
		a[i] = c;
		lenA = i + 1;
	}
	else
	{
		lenA = i;
	}
}

void ax2(int a[], int &lenA)
{
	int i, r, c;

	for (i = 0, r = 0, c = 0; i < lenA; i++)
	{
		r = (a[i] * 2 + c) % 10;
		c = (a[i] * 2 + c) / 10;
		a[i] = r;
	}

	if (c)
	{
		a[i] = c;
		lenA = i + 1;
	}
	else
	{
		lenA = i;
	}
}

int main()
{
	int n, i, x;
	string type;
	int index1, index2;

	cin >> n;

	for (i = 1; i <= n; i++)
	{
		cin >> type;
		cin >> x;

		if (type == "sell")
		{
			index[x][1] = i;
		}
		else
		{
			index[x][0] = i;
		}
	}

	bool ok;
	for (x = N - 2; x >= 0; x--)
	{
		if (index[x][0] && index[x][1])
		{
			index1 = index[x][0];
			index2 = index[x][1];

			ok = true;
			for (i = index1; i <= index2; i++)
			{
				if (used[i])
				{
					ok = false;
					break;
				}
			}

			if (ok)
			{
				best[x] = 1;
				for (i = index1; i <= index2; i++)
				{
					used[i] = true;
				}
			}
		}
	}

	exp2[0] = 1;
	len1 = 1;
	len2 = 1;
	for (i = 0; i < N - 4; i++)
	{
		if (best[i])
		{
			add(ans, len1, exp2, len2);
		}
		ax2(exp2, len2);
	}

	for (i = len1 - 1; i > 0 && ans[len1 - 1] == 0; i--)
	{
		len1--;
	}
	for (i = len1 - 1; i >= 0; i--)
	{
		cout << ans[i];
	}
	cout << endl;

	return 0;
}


#include <iostream>
//#include <set>
#include <string>

using namespace std;

/*
struct Item
{
	int index;
	int type;
	int x;

	bool operator < (const Item &other) const
	{
		return index < other.index;
	}
};*/

const int N = 2005;

int index[N][2];
bool used[5002];
int best[N];
int exp2[N];
int len1;
int ans[N];
int len2;

void add(int a[], int &lenA, int b[], int lenB)
{
	int i, r, c, end;
	end = max(lenA, lenB);

	for (i = 0, r = 0, c = 0; i <= end; i++)
	{
		r = (a[i] + b[i] + c) % 10;
		c = (a[i] + b[i] + c) / 10;
		a[i] = r;
	}

	if (c)
	{
		a[i] = c;
		lenA = i + 1;
	}
	else
	{
		lenA = i;
	}
}

void ax2(int a[], int &lenA)
{
	int i, r, c;

	for (i = 0, r = 0, c = 0; i < lenA; i++)
	{
		r = (a[i] * 2 + c) % 10;
		c = (a[i] * 2 + c) / 10;
		a[i] = r;
	}

	if (c)
	{
		a[i] = c;
		lenA = i + 1;
	}
	else
	{
		lenA = i;
	}
}

int main()
{
	int n, i, x;
	string type;
	int index1, index2;

	cin >> n;

	for (i = 1; i <= n; i++)
	{
		cin >> type;
		cin >> x;

		if (type == "sell")
		{
			index[x][1] = i;
		}
		else if (index[x][1] == 0)
		{
			index[x][0] = i;
		}
	}

	bool ok;
	for (x = N - 2; x >= 0; x--)
	{
		if (index[x][0] && index[x][1] && index[x][0] < index[x][1])
		{
			index1 = index[x][0];
			index2 = index[x][1];

			ok = true;
			for (i = index1; i <= index2; i++)
			{
				if (used[i])
				{
					ok = false;
					break;
				}
			}

			if (ok)
			{
				best[x] = 1;
				for (i = index1; i <= index2; i++)
				{
					used[i] = true;
				}
			}
		}
	}

	exp2[0] = 1;
	len1 = 1;
	len2 = 1;
	for (i = 0; i < N - 4; i++)
	{
		if (best[i])
		{
			add(ans, len1, exp2, len2);
		}
		ax2(exp2, len2);
	}

	for (i = len1 - 1; i > 0 && ans[len1 - 1] == 0; i--)
	{
		len1--;
	}
	for (i = len1 - 1; i >= 0; i--)
	{
		cout << ans[i];
	}
	cout << endl;

	return 0;
}


#include <iostream>
//#include <set>
#include <string>

using namespace std;

/*
struct Item
{
	int index;
	int type;
	int x;

	bool operator < (const Item &other) const
	{
		return index < other.index;
	}
};*/

const int N = 2001;

int index[N][2];
bool used[5002];
int best[N];
int exp2[N];
int len1;
int ans[N];
int len2;

void add(int a[], int &lenA, int b[], int lenB)
{
	int i, r, c, end;
	end = max(lenA, lenB);

	for (i = 0, r = 0, c = 0; i <= end; i++)
	{
		r = (a[i] + b[i] + c) % 10;
		c = (a[i] + b[i] + c) / 10;
		a[i] = r;
	}

	if (c)
	{
		a[i] = c;
		lenA = i + 1;
	}
	else
	{
		lenA = i;
	}
}

void ax2(int a[], int &lenA)
{
	int i, r, c;

	for (i = 0, r = 0, c = 0; i < lenA; i++)
	{
		r = (a[i] * 2 + c) % 10;
		c = (a[i] * 2 + c) / 10;
		a[i] = r;
	}

	if (c)
	{
		a[i] = c;
		lenA = i + 1;
	}
	else
	{
		lenA = i;
	}
}

int main()
{
	int n, i, x;
	string type;
	int index1, index2;

	cin >> n;

	for (i = 1; i <= n; i++)
	{
		cin >> type;
		cin >> x;

		if (type == "sell")
		{
			index[x][1] = i;
		}
		else
		{
			index[x][0] = i;
		}
	}

	bool ok;
	for (x = N - 2; x >= 0; x--)
	{
		if (index[x][0] && index[x][1] && index[x][0] < index[x][1])
		{
			index1 = index[x][0];
			index2 = index[x][1];

			ok = true;
			for (i = index1; i <= index2; i++)
			{
				if (used[i])
				{
					ok = false;
					break;
				}
			}

			if (ok)
			{
				best[x] = 1;
				for (i = index1; i <= index2; i++)
				{
					used[i] = true;
				}
			}
		}
	}

	exp2[0] = 1;
	len1 = 1;
	len2 = 1;
	for (i = 0; i < N - 4; i++)
	{
		if (best[i])
		{
			add(ans, len1, exp2, len2);
		}
		ax2(exp2, len2);
	}

	for (i = len1 - 1; i > 0 && ans[len1 - 1] == 0; i--)
	{
		len1--;
	}
	for (i = len1 - 1; i >= 0; i--)
	{
		cout << ans[i];
	}
	cout << endl;

	return 0;
}


#include <iostream>
//#include <set>
#include <string>

using namespace std;

/*
struct Item
{
	int index;
	int type;
	int x;

	bool operator < (const Item &other) const
	{
		return index < other.index;
	}
};*/

const int N = 2001;

int index[N][2];
bool used[5002];
int best[N];
int exp2[N];
int len1;
int ans[N];
int len2;

void add(int a[], int &lenA, int b[], int lenB)
{
	int i, r, c, end;
	end = max(lenA, lenB);

	for (i = 0, r = 0, c = 0; i <= end; i++)
	{
		r = (a[i] + b[i] + c) % 10;
		c = (a[i] + b[i] + c) / 10;
		a[i] = r;
	}

	if (c)
	{
		a[i] = c;
		lenA = i + 1;
	}
	else
	{
		lenA = i;
	}
}

void ax2(int a[], int &lenA)
{
	int i, r, c;

	for (i = 0, r = 0, c = 0; i < lenA; i++)
	{
		r = (a[i] * 2 + c) % 10;
		c = (a[i] * 2 + c) / 10;
		a[i] = r;
	}

	if (c)
	{
		a[i] = c;
		lenA = i + 1;
	}
	else
	{
		lenA = i;
	}
}

int main()
{
	int n, i, x;
	string type;
	int index1, index2;

	cin >> n;

	for (i = 1; i <= n; i++)
	{
		cin >> type;
		cin >> x;

		if (type == "sell")
		{
			index[x][1] = i;
		}
		else
		{
			index[x][0] = i;
		}
	}

	bool ok;
	for (x = N - 2; x >= 0; x--)
	{
		if (index[x][0] && index[x][1])
		{
			index1 = index[x][0];
			index2 = index[x][1];

			ok = true;
			for (i = index1; i <= index2; i++)
			{
				if (used[i])
				{
					ok = false;
					break;
				}
			}

			if (ok)
			{
				best[x] = 1;
				for (i = index1; i <= index2; i++)
				{
					used[i] = true;
				}
			}
		}
	}

	exp2[0] = 1;
	len1 = 1;
	len2 = 1;
	for (i = 0; i < N - 4; i++)
	{
		if (best[i])
		{
			add(ans, len1, exp2, len2);
		}
		ax2(exp2, len2);
	}

	if (ans[len1 - 1] == 0 && len1 != 1)
	{
		len1--;
	}
	for (i = len1 - 1; i >= 0; i--)
	{
		cout << ans[i];
	}
	cout << endl;

	return 0;
}


#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#define INF 2100000000
using namespace std;
bool cmp(int a,int b)
{
    return a>b;
}
char str[1000];
char* Gplus(char* a,char* b)
{
    int La,Lb,jin=0,i,j;
    char tmp;
    La=strlen(a);
    Lb=strlen(b);
    for(i=0;i<La&&i<Lb;i++)
    {
        str[i]=(a[La-1-i]-'0'+b[Lb-1-i]-'0'+jin)%10+'0';
        jin=(a[La-1-i]-'0'+b[Lb-1-i]-'0'+jin)/10;
    }
    if(La==Lb)
    {
        if(jin!=0)
        {
            str[i]=jin+'0';
            i++;
        }
    }
    else if(La<Lb)
    {
        for(;i<Lb;i++)
        {
            str[i]=(b[Lb-1-i]-'0'+jin)%10+'0';
            jin=(b[Lb-1-i]-'0'+jin)/10;
        }
        if(jin!=0)
        {
            str[i]=jin+'0';
            i++;
        }
    }
    else
    {
        for(;i<La;i++)
        {
            str[i]=(a[La-1-i]-'0'+jin)%10+'0';
            jin=(a[La-1-i]-'0'+jin)/10;
        }
        if(jin!=0)
        {
            str[i]=jin+'0';
            i++;
        }
    }
    for(j=i-1;j>=i/2;j--)
    {
        tmp=str[i-1-j];
        str[i-1-j]=str[j];
        str[j]=tmp;
    }
    str[i]='\0';
    //cout<<a<<'+'<<b<<'='<<str<<endl;
    return str;
}
char* Gmult(char* a,char* b)
{

    return str;
}
int main()
{
	int N,i,j,k,temp;
	char act[10],lastact[10],sum[1000],ans[1000],num2[2]="2";
	vector<int> win,sell;
	vector<int>::iterator iter;
	scanf("%d",&N);
	strcpy(sum,"0");
	for(i=1;i<=N;i++)
    {
        scanf("%s",act);
        if(strcmp(act,"win")==0)
        {
            if(strcmp(lastact,"sell")==0)
            {
                sort(win.begin(),win.end());
                sort(sell.begin(),sell.end(),cmp);
                for(j=0;j<sell.size();j++)
                {
                    if(*(lower_bound(win.begin(),win.end(),sell[j]))==sell[j])
                    {
                        strcpy(ans,"1");
                        for(k=1;k<=sell[j];k++)
                            strcpy(ans,Gplus(ans,ans));
                        strcpy(sum,Gplus(sum,ans));
                        break;
                    }
                }
                win.clear();
                sell.clear();
            }
            scanf("%d",&temp);
            win.push_back(temp);
            strcpy(lastact,act);
        }
        else
        {
            scanf("%d",&temp);
            sell.push_back(temp);
            strcpy(lastact,act);
        }
    }
    if(strcmp(lastact,"sell")==0)
    {
        sort(win.begin(),win.end());
        sort(sell.begin(),sell.end(),cmp);
        for(j=0;j<sell.size();j++)
        {
            iter=lower_bound(win.begin(),win.end(),sell[j]);
            if(iter!=win.end()&&*iter==sell[j])
            {
                strcpy(ans,"1");
                for(k=1;k<=sell[j];k++)
                    strcpy(ans,Gplus(ans,ans));
                strcpy(sum,Gplus(sum,ans));
                break;
            }
        }
        win.clear();
        sell.clear();
    }
    printf("%s",sum);
	return 0;
}


#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#define INF 2100000000
using namespace std;
char str[1000];
class SELL
{
public:
    int x,last,pos;
    SELL(int a,int b,int c)
    {
        x=a;
        last=b;
        pos=c;
    }
};
bool cmp(SELL a,SELL b)
{
    if(a.x>b.x)
        return true;
    else if(a.x==b.x&&a.pos<b.pos)
        return true;
    else
        return false;
}
char* Gplus(char* a,char* b)
{
    int La,Lb,jin=0,i,j;
    char tmp;
    La=strlen(a);
    Lb=strlen(b);
    for(i=0;i<La&&i<Lb;i++)
    {
        str[i]=(a[La-1-i]-'0'+b[Lb-1-i]-'0'+jin)%10+'0';
        jin=(a[La-1-i]-'0'+b[Lb-1-i]-'0'+jin)/10;
    }
    if(La==Lb)
    {
        if(jin!=0)
        {
            str[i]=jin+'0';
            i++;
        }
    }
    else if(La<Lb)
    {
        for(;i<Lb;i++)
        {
            str[i]=(b[Lb-1-i]-'0'+jin)%10+'0';
            jin=(b[Lb-1-i]-'0'+jin)/10;
        }
        if(jin!=0)
        {
            str[i]=jin+'0';
            i++;
        }
    }
    else
    {
        for(;i<La;i++)
        {
            str[i]=(a[La-1-i]-'0'+jin)%10+'0';
            jin=(a[La-1-i]-'0'+jin)/10;
        }
        if(jin!=0)
        {
            str[i]=jin+'0';
            i++;
        }
    }
    for(j=i-1;j>=i/2;j--)
    {
        tmp=str[i-1-j];
        str[i-1-j]=str[j];
        str[j]=tmp;
    }
    str[i]='\0';
    //cout<<a<<'+'<<b<<'='<<str<<endl;
    return str;
}

int main()
{
	int N,i,j,k,temp,win[2001];
	char act[10],lastact[10],sum[1000],ans[1000],num2[2]="2";
	bool able,used[2001]={0};
	vector<SELL> sell;
	for(i=0;i<=2000;i++)
        win[i]=-1;
	scanf("%d",&N);
	strcpy(sum,"0");
	for(i=1;i<=N;i++)
    {
        scanf("%s",act);
        if(strcmp(act,"win")==0)
        {
            scanf("%d",&temp);
            win[temp]=i;
        }
        else
        {
            scanf("%d",&temp);
            if(win[temp]!=-1)
                sell.push_back(SELL(temp,win[temp],i));
        }
    }
    sort(sell.begin(),sell.end(),cmp);
    for(i=0;i<sell.size();i++)
    {
        able=true;
        for(j=sell[i].pos;j>=sell[i].last;j--)
            if(used[j])
            {
                able=false;
                break;
            }
        if(able)
        {
            for(j=sell[i].pos;j>=sell[i].last;j--)
                used[j]=true;
            strcpy(ans,"1");
            for(k=1;k<=sell[i].x;k++)
                strcpy(ans,Gplus(ans,ans));
            strcpy(sum,Gplus(sum,ans));
        }
    }
    printf("%s",sum);
	return 0;
}


#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#define INF 2100000000
using namespace std;
char str[1000];
class SELL
{
public:
    int x,last,pos;
    SELL(int a,int b,int c)
    {
        x=a;
        last=b;
        pos=c;
    }
};
bool cmp(SELL a,SELL b)
{
    if(a.x>b.x)
        return true;
    else if(a.x==b.x&&(a.pos-a.last)<(b.pos-b.last))
        return true;
    else
        return false;
}
char* Gplus(char* a,char* b)
{
    int La,Lb,jin=0,i,j;
    char tmp;
    La=strlen(a);
    Lb=strlen(b);
    for(i=0;i<La&&i<Lb;i++)
    {
        str[i]=(a[La-1-i]-'0'+b[Lb-1-i]-'0'+jin)%10+'0';
        jin=(a[La-1-i]-'0'+b[Lb-1-i]-'0'+jin)/10;
    }
    if(La==Lb)
    {
        if(jin!=0)
        {
            str[i]=jin+'0';
            i++;
        }
    }
    else if(La<Lb)
    {
        for(;i<Lb;i++)
        {
            str[i]=(b[Lb-1-i]-'0'+jin)%10+'0';
            jin=(b[Lb-1-i]-'0'+jin)/10;
        }
        if(jin!=0)
        {
            str[i]=jin+'0';
            i++;
        }
    }
    else
    {
        for(;i<La;i++)
        {
            str[i]=(a[La-1-i]-'0'+jin)%10+'0';
            jin=(a[La-1-i]-'0'+jin)/10;
        }
        if(jin!=0)
        {
            str[i]=jin+'0';
            i++;
        }
    }
    for(j=i-1;j>=i/2;j--)
    {
        tmp=str[i-1-j];
        str[i-1-j]=str[j];
        str[j]=tmp;
    }
    str[i]='\0';
    //cout<<a<<'+'<<b<<'='<<str<<endl;
    return str;
}

int main()
{
	int N,i,j,k,temp,win[2001];
	char act[10],lastact[10],sum[1000],ans[1000],num2[2]="2";
	bool able,used[2001]={0};
	vector<SELL> sell;
	for(i=0;i<=2000;i++)
        win[i]=-1;
	scanf("%d",&N);
	strcpy(sum,"0");
	for(i=1;i<=N;i++)
    {
        scanf("%s",act);
        if(strcmp(act,"win")==0)
        {
            scanf("%d",&temp);
            win[temp]=i;
        }
        else
        {
            scanf("%d",&temp);
            if(win[temp]!=-1)
                sell.push_back(SELL(temp,win[temp],i));
        }
    }
    sort(sell.begin(),sell.end(),cmp);
    for(i=0;i<sell.size();i++)
    {
        able=true;
        for(j=sell[i].pos;j>=sell[i].last;j--)
            if(used[j])
            {
                able=false;
                break;
            }
        if(able)
        {
            for(j=sell[i].pos;j>=sell[i].last;j--)
                used[j]=true;
            strcpy(ans,"1");
            for(k=1;k<=sell[i].x;k++)
                strcpy(ans,Gplus(ans,ans));
            strcpy(sum,Gplus(sum,ans));
        }
    }
    printf("%s",sum);
	return 0;
}


#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#define INF 2100000000
using namespace std;
char str[1000];
class SELL
{
public:
    int x,pos;
    SELL(int a,int c)
    {
        x=a;
        pos=c;
    }
};
bool cmp(SELL a,SELL b)
{
    return a.x>b.x;
}
char* Gplus(char* a,char* b)
{
    int La,Lb,jin=0,i,j;
    char tmp;
    La=strlen(a);
    Lb=strlen(b);
    for(i=0;i<La&&i<Lb;i++)
    {
        str[i]=(a[La-1-i]-'0'+b[Lb-1-i]-'0'+jin)%10+'0';
        jin=(a[La-1-i]-'0'+b[Lb-1-i]-'0'+jin)/10;
    }
    if(La==Lb)
    {
        if(jin!=0)
        {
            str[i]=jin+'0';
            i++;
        }
    }
    else if(La<Lb)
    {
        for(;i<Lb;i++)
        {
            str[i]=(b[Lb-1-i]-'0'+jin)%10+'0';
            jin=(b[Lb-1-i]-'0'+jin)/10;
        }
        if(jin!=0)
        {
            str[i]=jin+'0';
            i++;
        }
    }
    else
    {
        for(;i<La;i++)
        {
            str[i]=(a[La-1-i]-'0'+jin)%10+'0';
            jin=(a[La-1-i]-'0'+jin)/10;
        }
        if(jin!=0)
        {
            str[i]=jin+'0';
            i++;
        }
    }
    for(j=i-1;j>=i/2;j--)
    {
        tmp=str[i-1-j];
        str[i-1-j]=str[j];
        str[j]=tmp;
    }
    str[i]='\0';
    //cout<<a<<'+'<<b<<'='<<str<<endl;
    return str;
}
bool cmp2(int a,int b)
{
    return a>b;
}
int main()
{
	int N,i,j,k,last,temp;
	char act[10],lastact[10],sum[1000],ans[1000],num2[2]="2";
	bool able,used[2001]={0};
	vector<SELL> sell;
	vector<int> win[2001];
	scanf("%d",&N);
	strcpy(sum,"0");
	for(i=1;i<=N;i++)
    {
        scanf("%s",act);
        if(strcmp(act,"win")==0)
        {
            scanf("%d",&temp);
            win[temp].push_back(i);
            sort(win[temp].begin(),win[temp].end(),cmp2);
        }
        else
        {
            scanf("%d",&temp);
            if(!win[temp].empty())
                sell.push_back(SELL(temp,i));
        }
    }
    sort(sell.begin(),sell.end(),cmp);
    for(i=0;i<sell.size();i++)
    {
        able=false;
        for(j=0;j<win[sell[i].x].size();j++)
        {
            if(!used[win[sell[i].x][j]]&&win[sell[i].x][j]<sell[i].pos)
            {
                able=true;
                last=win[sell[i].x][j];
                break;
            }
        }
        if(able)
        {
            for(j=sell[i].pos;j>=last;j--)
                used[j]=true;
            strcpy(ans,"1");
            for(k=1;k<=sell[i].x;k++)
                strcpy(ans,Gplus(ans,ans));
            strcpy(sum,Gplus(sum,ans));
        }
    }
    printf("%s",sum);
	return 0;
}