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

class burean implements Runnable{
    public void run(){
       try{
           Scanner in = new Scanner(new File("bureau.in"));
           PrintWriter out = new PrintWriter(new File("bureau.out"));

           int n = in.nextInt();
           int[] k =new int[n];
           for(int i =0; i < n; i++){
              k[i]=0;
           }
           for(int i =0; i < n; i++){
               String str = in.next();
               if(str.charAt(0)=='d'){
                   k[i]=n+1;
               }
                else{
                   k[i] = in.nextInt();
               }
           }
           int cnt = 0;
           for(int i =n-1; i >0; i--){
             if(k[i]!=0 && k[i]!=n+1){
                 int l = k[i]-1;
                 k[l]=0;
                 cnt++;
             }
             else if(k[i]==n+1) cnt++;
           }

          if(k[0]!=0) cnt++;
          out.println(cnt);

          for(int i =0; i < n; i++){
               if(k[i]!=0){
                out.print(i+1);
                out.print(' ');
               }
           }

           in.close();
           out.close();
       }  catch(Exception e){
               e.printStackTrace();
               System.exit(1);
          }
     }
     public static void main(String[] args) {
       new Thread(new burean()).start();
    }
}
