/*--------------------------------------------------------------*/
/* ACM ICPC 2009-2010, NEERC                                    */
/* Northern Subregional Contest                                 */
/* St Petersburg, October 17, 2009                              */
/*--------------------------------------------------------------*/
/* Problem B. Bureaucracy                                       */
/*                                                              */
/* Original idea         Pavel Mavrin                           */
/* Problem statement     Dmitry Paraschenko                     */
/* Testset               Dmitry Paraschenko                     */
/*--------------------------------------------------------------*/
/* Solution                                                     */
/*                                                              */
/* Author                Georgiy Korneev                        */
/*--------------------------------------------------------------*/
 
import java.util.*;
import java.io.*;

public class bureau_gk_ok_check implements Runnable {
    static Scanner in;
    static PrintWriter out;
    static final int MAX_N = 100000;

    public void run() {
        int n = in.nextInt();

        assert (1 <= n && n <= MAX_N);
        
        int[] laws = new int[n];
        for (int i = 0; i < n; i++) {
            final String type = in.next();
            if (type.equals("declare")) {
                laws[i] = -1;
            } else {
                assert type.equals("cancel");
                laws[i] = in.nextInt();
                assert 1 <= laws[i] && laws[i] <= i;
            }
        }
        boolean[] cancelled = new boolean[n];
        for (int i = n - 1; i >= 0; i--) {
            if (!cancelled[i] && laws[i] != -1) {
                cancelled[laws[i] - 1] = true;
            }
        }
        
        int c = 0;
        for (boolean b : cancelled) {
            if (!b) {
                c++;
            }
        }
        
        out.println(c);
        for (int i = 0; i < n; i++) {
            if (!cancelled[i]) {
                out.print((i + 1) + " " );
            }
        }
        out.println();
    }

    public static void main(String[] args) throws Exception {        
        in = new Scanner(new File("bureau.in"));
        out = new PrintWriter("bureau.out");

        new bureau_gk_ok_check().run();

        in.close();
        out.close();
    }
}
