{$APPTYPE CONSOLE}

const
    inFile = 'jurassic.in';
    outFile = 'jurassic.out';

    maxN = 24;

var
    n : integer;
    a : array[1..maxN] of longword;
    ansK : integer;
    ansX : longword;

procedure Solve;
var
    i, mask, cur : longword;
    j, k : integer;

begin
    ansK := 0;
    for i := 1 to (1 shl n) - 1 do begin
        cur := 0;
        mask := 1;
        k := 0;
        for j := 1 to n do begin
            if i and mask <> 0 then begin
                cur := cur xor a[j];
                inc(k);
            end;
            mask := mask shl 1;
        end;

        if (cur = 0) and (k > ansK) then begin
            ansK := k;
            ansX := i;
        end;
    end;
end;

procedure ReadData;
var
    i, j : integer;
    s : string;

begin

    readln(n);
    if (n < 1) or (n > maxN) then
        RunError(239);

    for i := 1 to n do begin
        readln(s);
        if length(s) = 0 then
            RunError(239);
        a[i] := 0;
        for j := 1 to length(s) do begin
            if (s[j] < 'A') or (s[j] > 'Z') then
                RunError(239);
            a[i] := a[i] or (1 shl (ord(s[j]) - ord('A')));
        end;
    end;

    close(input);
end;

procedure WriteData;
var
    i : integer;

begin

    writeln(ansK);
    for i := 1 to n do
        if ansX and (1 shl (i - 1)) <> 0 then
            write(i, ' ');
    writeln;

    close(output);
end;

begin
    ReadData;
    Solve;
    WriteData;
end.
