/*--------------------------------------------------------------*/
/* 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.io.*;

public class bureau_gk implements Runnable {
    static Reader in;
    static PrintWriter out;

    private int nextInt() {
        return Integer.parseInt(nextWord());
    }

    private String nextWord() {
        try {
            int ch = in.read();
            while (ch <= ' ') {
                ch = in.read();
            }
            StringBuilder sb = new StringBuilder();
            while (ch > ' ') {
                sb.append((char) ch);
                ch = in.read();
            }
            return sb.toString();
        } catch (IOException e) {
            throw new AssertionError(e);
        }
    }
    
    public void run() {
        int n = nextInt();
        
        int[] laws = new int[n];
        for (int i = 0; i < n; i++) {
            final String type = nextWord();
            if (type.equals("declare")) {
                laws[i] = -1;
            } else {
                laws[i] = 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 BufferedReader(new FileReader("bureau.in"));
        out = new PrintWriter("bureau.out");

        new bureau_gk().run();

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