/**
 * Created by IntelliJ IDEA.
 * User: m09dam
 * Date: 02.12.2009
 * Time: 16:09:58
 * To change this template use File | Settings | File Templates.
 */
import java.util.*;
import java.io.*;
public class program_B_2_12_09 {
    public static void main(String[]args)throws Exception{
        Scanner in = new Scanner (new File("bureau.in"));
        PrintWriter out = new PrintWriter (new File("bureau.out"));
        int n = in.nextInt();
        int i = 0;
        String s;
        String[] a = new String[n];
        LinkedList<Integer> p = new LinkedList<Integer>();
        while(in.hasNext()){
            s = in.next();
            if(s.equals("declare")){
                a[i] = s;
                i = i + 1;
            }
            else if (s.equals("cancel")){
            a[i] = s;
            i = i + 1;
            p.addLast(in.nextInt());
            }
        }
        for(int j = 0;j < i;j++){
            if(a[i-j-1].equals("cancel")){
                a[p.getLast()-1]="";
                p.removeLast();
                }
        }
        int t = 0;
        for(int j = 0;j < i;j++){
            if (!a[j].equals("")){
                t = t + 1;
            }
        }
        out.println(t);
        for(int j = 0;j < i;j++){
            if (!a[j].equals("")){
                out.print(j+1);
                out.print(' ');
            }
        }
        out.close();
        in.close();
  }
}
