/*
TASK: abc
LANG:C++
*/

#include <iostream>
//#include <set>

using namespace std;

struct dr
{
    int nom,den;
};

int gcd(int a,int b)
{
    if((a==1)||(b==1))
        return 1;
    while((a)&&(b))
    {
        if(a>b)
            a%=b;
        else
            b%=a;
    }
    return a?a:b;
}

void nor(struct dr *a)
{
    int nod=gcd(a->nom,a->den);
    a->nom/=nod;
    a->den/=nod;
}

struct dr operator+(struct dr a,struct dr b)
{
    struct dr res;
    res.den=a.den*b.den;
    res.nom=a.nom*b.den+b.nom*a.den;
    nor(&res);
    return res;
}

int cmp(const void *a,const void *b)
{
    if(*(string *)a<*(string *)b)
        return -1;
    if(*(string *)a==*(string *)b)
        return 0;
    return 1;
}

string str[1<<5],res[1<<5];
int n,i,j;
dr r={0,1},c;
int main()
{
    cin>>n;
    for(i=0;i<n;i++)
        cin>>str[i];
    qsort(str,n,sizeof(str[0]),cmp);
    i=0;
    j=1;
    res[0]=str[0];
    while(j<n)
    {
        while(str[j].find(res[i])==0)
            j++;
        res[++i]=str[j];
    }
/*    for(j=0;j<i;j++)
        cout<<res[j]<<" ";   */
    for(j=0;j<i;j++)
    {
        c.nom=1;
        c.den=1<<res[j].length();
        c.den<<=1;
        r=r+c;
    }
    cout<<r.nom<<" "<<r.den<<"\n";
    return 0;
}
