{$q+,r+}
const
    max_n = 24;
var
    i, j, n, m: longint;
    a: array [1..max_n] of longint;
    u, mu: array [1..max_n] of boolean;
    s: string;

procedure find(i, s, q: longint);
begin
    if i > n then begin
        if (q = 0) and (m < s) then begin
            m := s;
            mu := u;
        end;
    end else begin
        u[i] := true;
        find(i + 1, s + 1, q xor a[i]);
        u[i] := false;
        find(i + 1, s, q);
    end;
end;

begin
    readln(n);

    for i := 1 to n do begin
        readln(s);
        a[i] := 0;
        for j := 1 to length(s) do begin
            a[i] := a[i] or (1 shl (ord(s[j]) - ord('A')));
        end;
    end;

    m := 0;
    fillchar(u, sizeof(u), 0);

    find(1, 0, 0);

    writeln(m);
    for i := 1 to n do begin
        if mu[i] then begin
            write(i, ' ');
        end;
    end;
    writeln;

    close(input);
    close(output);
end.