public static void main(String[] args) throws Throwable{
		BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
		ArrayList<int[]> elefantes=new ArrayList<int[]>();
		elefantes.add(new int[]{0,100001});
		for(String ln;(ln=in.readLine())!=null;){
			StringTokenizer st=new StringTokenizer(ln);
			elefantes.add(new int[]{parseInt(st.nextToken()),parseInt(st.nextToken())});
		}
		arr=new int[elefantes.size()][];
		for(int i=0;i<elefantes.size();i++)arr[i]=elefantes.get(i);
		Arrays.sort(arr, new Comparator<int[]>() {
			public int compare(int[] o1, int[] o2) {
				return o1[0]!=o2[1]?o1[0]-o2[0]:o1[1]-o2[1];
			}
		});
		mem=new int[elefantes.size()][elefantes.size()][];
		//for(int i[]:arr)System.out.println(Arrays.toString(i));
		System.out.println(f(0,1));
		boolean ws=true;
		for(int i=0,j=1;j<mem.length;){
			if(mem[i][j][1]==1){
				if(!ws){
					int h=0;
					for(;h<arr.length;h++)if(elefantes.get(h)==arr[j])break;
					System.out.println(h);
				}
				i=j;j++;
			}
			else j++;
			ws=false;
		}
	}