import java.io.*; import java.util.*; public class SocialDistancingInCinema { //@formatter:off static final int[][] forbiddenNeighbors = { {-4,-3,-2,-1, 0, 1, 2, 3, 4,}, // -9 {-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5,}, // -8 {-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7,}, // -7 {-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7,}, // -6 {-8,-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7, 8,}, // -5 {-9,-8,-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,}, // -4 {-9,-8,-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,}, // -3 {-9,-8,-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,}, // -2 {-9,-8,-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,}, // -1 {-9,-8,-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,}, // 0 {-9,-8,-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,}, // 1 {-9,-8,-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,}, // 2 {-9,-8,-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,}, // 3 {-9,-8,-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,}, // 4 {-8,-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7, 8,}, // 5 {-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7,}, // 6 {-7,-6,-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5, 6, 7,}, // 7 {-5,-4,-3,-2,-1, 0, 1, 2, 3, 4, 5,}, // 8 {-4,-3,-2,-1, 0, 1, 2, 3, 4,}, // 9 }; //@formatter:on static final int[] length = {9, 11, 15, 15, 17, 19, 19, 19, 19, 19, 19, 19, 19, 19, 17, 15, 15, 11, 9}; private static final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); private static final PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); private static StringTokenizer st; private static int readInt() throws IOException { while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine()); return Integer.parseInt(st.nextToken()); } public static void main(String[] args) throws IOException { ArrayList answer = solve(); pw.println(answer.size()); for (int i : answer) { pw.print(i + " "); } pw.println(); pw.close(); } private static ArrayList solve() throws IOException { int N = readInt(); System.out.println(N); int[][] index = new int[518][518]; boolean[][] present = new boolean[518][518]; for (int i = 1; i <= N; i++) { int x = readInt() + 8; int y = readInt() + 8; index[x][y] = i; present[x][y] = true; } ArrayList selected = new ArrayList<>(); int direction = 1; for (int i = 9; i <= 508; i++) { int keepDirection = 1; if (direction == 1) { for (int j = 9; j <= 508; j++) { if (present[i][j]) { selected.add(index[i][j]); for (int k = 0, r = -9; k < 19; k++, r++) { for (int l = length[k] - 1; l >= 0; l--) { present[i + r][j + forbiddenNeighbors[k][l]] = false; } } keepDirection = -1; } } } else { for (int j = 508; j >= 9; j--) { if (present[i][j]) { selected.add(index[i][j]); for (int k = 0, r = -9; k < 19; k++, r++) { for (int l = length[k] - 1; l >= 0; l--) { present[i + r][j + forbiddenNeighbors[k][l]] = false; } } keepDirection = -1; } } } direction *= keepDirection; } return selected; } }