/*--------------------------------------------------------------*/
/* 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                Andrew Stankevich                      */
/*--------------------------------------------------------------*/
 
import java.util.*;
import java.math.*;
import java.io.*;

class bureau_as implements Runnable {
    public void solve() throws IOException {
        BufferedReader in = new BufferedReader(new FileReader("bureau.in"));
        PrintWriter out = new PrintWriter(new File("bureau.out"));

        int n = Integer.parseInt(in.readLine());
        boolean[] cancelled = new boolean[n];
        int[] which = new int[n];
        Arrays.fill(which, -1);
        for (int i = 0; i < n; i++) {
            StringTokenizer st = new StringTokenizer(in.readLine());
            String command = st.nextToken();
            if (command.equals("cancel")) {
                int w = Integer.parseInt(st.nextToken());
                which[i] = w - 1;
            }
        }

        int t = 0;
        for (int i = n - 1; i >= 0; i--) {
            if (!cancelled[i]) {
                if (which[i] != -1) {
                    cancelled[which[i]] = true;
                }
                t++;
            }
        }

        out.println(t);
        for (int i = 0; i < n; i++) {
            if (!cancelled[i]) {
                out.print((i + 1) + " ");
            }
        }
        out.println();

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

    public void run() {
        try {
            solve();
        } catch (IOException e) {
            e.printStackTrace();
            throw new AssertionError();
        }
    }

    public static void main(String[] args) {
        new Thread(new bureau_as()).start();
    }
}