/*--------------------------------------------------------------*/
/* 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 implements Runnable {
    static Scanner in;
    static PrintWriter out;

    public void run() {
        int n = in.nextInt();
        
        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 {
                laws[i] = in.nextInt();
            }
        }
        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(System.in);
        out = new PrintWriter(System.out);

        new bureau_gk_ok().run();

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