// Solution for "Jurassic Remains" problem, NEERC'2003
// (C) Roman Elizarov, 2003

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

public class j_re {
	private static int best_bones;
	private static int best_len;
	private static int n;

	private static int[] patterns;

	private static void find(int joints, int bones, int len, int i) {
	        if (joints == 0 && len > best_len) {
	        	best_bones = bones;
	        	best_len = len;
	        }
	        if (len + (n - i) <= best_len || i >= n)
	        	return;
		find(joints, bones, len, i + 1);
		find(joints ^ patterns[i], bones | (1 << i), len + 1, i + 1);
	}

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		n = Integer.parseInt(in.readLine().trim());
		patterns = new int[n];
		for (int i = 0; i < n; i++) {
			String s = in.readLine();
			for (int j = s.length(); --j >= 0;)
				patterns[i] |= 1 << (s.charAt(j) - 'A');
		}	
		in.close();

		find(0, 0, 0, 0);

		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		out.println(best_len);
		for (int i = 0; i < n; i++)
			if ((best_bones & (1 << i)) != 0)
				out.print((i + 1) + " ");
		out.close();
	}
}
