{
TASK: abc
LANG:PASCAL
}

Program ABC;
 Var Enter, I, J, R, Zn, Br, Ch: Integer;
     SR: String;
     S: Array[1..999] of String[20];
     Bl: Array[1..999] of Boolean;
     L, K: Array[1..999] of Byte;
 Begin
  ReadLn(Enter);
  For I := 1 to Enter do
   Begin
    ReadLn(S[I]);
    L[I] := Length(S[I]);
   End;
  For I := 1 to Enter do
   For J := I + 1 to Enter do
    If L[I] > L[J] then Begin
                         R := L[I];
                         L[I] := L[J];
                         L[J] := L[I];
                         SR := S[I];
                         S[I] := S[J];
                         S[J] := SR;
                        End;
  For I := 1 to Enter do
   For J := I + 1 to Enter do
    Begin
     SR := Copy(S[J], 1, Length(S[I]));
     If S[I] = SR then Bl[J] := True;
    End;
  For I := Enter downto 1 do If not(Bl[I]) then Begin R := Length(S[I]); Break End;
  For I := 1 to Enter do If not(Bl[I]) then Begin
                                             Inc(Br);
                                             K[Br] := R - L[I];
                                            End;
  Zn := 1;
  For I := 1 to Br do Begin
                       R := 1;
                       For J := 1 to K[I] do R := R * 4;
                       Ch := Ch + R;
                      End;
  For I := 1 to R do Zn := Zn * 4;
  For I := Ch downto 2 do If (Ch mod I = 0) and (Zn mod I = 0) then Begin
                                                                     Ch := Ch div I;
                                                                     Zn := Zn div I;
                                                                     Break
                                                                    End;

  WriteLn(Ch,' ', Zn);
 End.