/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

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

/**
 *
 * @author m09cke
 */
public class Main{


    public static boolean count(int a[]){
        int c=0;
        for (int i=1; i<a.length; i++){
            if (a[i]>(a[i-1]+1)){
                c++;
            }
        }
        c++;
        if (c==a.length){
            return(true);
        }
        else{
            return(false);
        }
    }



    public static void main(String[] args)throws IOException{
        StreamTokenizer in = new StreamTokenizer( new BufferedReader( new FileReader( new File( "rvq.in"))));
            PrintStream out = new PrintStream(new File("rvq.out"));
            in.nextToken();
            int n = (int)in.nval;
            int[] a = new int[n];
            boolean[] b = new boolean[n];
            Arrays.fill(b, true);
            for (int i=0; i<n; i++){
                in.nextToken();
                if (in.sval.charAt(0)=='d'){
                    a[i]=0;
                }
                else{
                    in.nextToken();
                    a[i] = (int)in.nval;
                }
            }
            int s=0;
            for (int i=n-1; i>=0; i--){
                if (b[i]&&a[i]>0){
                    b[a[i]-1]=false;
                }
            }
            for (int i=0; i<n; i++){
                if (b[i]){
                    s++;
                }
            }
            out.println(s);
            for (int i=0;i<n;i++){
                if (b[i]){
                    out.print((i+1)+" ");
                }
            }
            out.close();
    }

}

