program dinosaur;

const
    maxn = 30;

type
    tbone = array ['A'..'Z'] of boolean;

var
    n: longint;
    a: array [1..maxn] of tbone;
    u, bu: array [1..maxn] of boolean;
    best: longint;


procedure search(i, c: longint; const x: tbone);
var
    y: tbone;
    j: char;
    flag: boolean;
begin
    if i > n then
    begin
        if (c > best) then
        begin
            flag := true;
            for j := 'A' to 'Z' do
                if x[j] then
                begin
                    flag := false;
                    break;
                end;
            if flag then
            begin
                best := c;
                bu := u;
            end;
        end;
        exit;
    end;

    u[i] := false;
    search(i + 1, c, x);
    u[i] := true;
    for j := 'A' to 'Z' do
        y[j] := x[j] xor a[i][j];
    search(i + 1, c + 1, y);
end;

var
    i: longint;
    s: string;
    c: char;
    x: tbone;

begin
    readln(n);
    for i := 1 to n do
    begin
        readln(s);
        for c := 'A' to 'Z' do
        begin
            a[i][c] := pos(c, s) <> 0;
        end;
    end;

    best := 0;
    fillchar(u, sizeof(u), 0);
    fillchar(bu, sizeof(bu), 0);
    fillchar(x, sizeof(x), 0);
    search(1, 0, x);

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

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