import sys import numpy as np read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(readline()) XY = np.array(read().split(), np.int64) X, Y = XY[::2], XY[1::2] key1 = X % 9 key2 = Y % 5 key3 = ((X // 9) + (Y // 5)) & 1 key = key1 * 10 + key2 * 2 + key3 most_freq = np.bincount(key).argmax() ans = np.where(key == most_freq)[0] print(len(ans)) print('\n'.join(map(str, ans.tolist())))