/* In the name of ALLAH, most gracious, most merciful */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< int, int > pi;
const int tot = ((1 << 26) - 1);
int masks[30];
char s[110];
int n;
int solve(int idx, int mask){
if(idx == n){
return (mask == tot);
}
return solve(idx + 1, mask) + solve(idx + 1, mask | masks[idx]);
}
int main()
{
scanf("%d", &n);
for(int i = 0; i < n; i++){
scanf("%s", s);
int l = strlen(s);
for(int j = 0; j < l; j++){
masks[i] |= 1 << (s[j] - 'a');
}
}
cout << solve(0, 0) << endl;
return 0;
}
LyogSW4gdGhlIG5hbWUgb2YgQUxMQUgsIG1vc3QgZ3JhY2lvdXMsIG1vc3QgbWVyY2lmdWwgKi8KI2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiAKIAp1c2luZyBuYW1lc3BhY2Ugc3RkOwp0eXBlZGVmIGxvbmcgbG9uZyBsbDsKdHlwZWRlZiBwYWlyPCBpbnQsIGludCA+IHBpOwogCmNvbnN0IGludCB0b3QgPSAoKDEgPDwgMjYpICAtIDEpOwogCmludCBtYXNrc1szMF07CmNoYXIgc1sxMTBdOwppbnQgbjsKIAppbnQgc29sdmUoaW50IGlkeCwgaW50IG1hc2spewogICAgaWYoaWR4ID09IG4pewogICAgICAgIHJldHVybiAobWFzayA9PSB0b3QpOwogICAgfQogICAgcmV0dXJuIHNvbHZlKGlkeCArIDEsIG1hc2spICsgc29sdmUoaWR4ICsgMSwgbWFzayB8IG1hc2tzW2lkeF0pOwp9CiAKaW50IG1haW4oKQp7CiAgICAKICAgIHNjYW5mKCIlZCIsICZuKTsKICAgIAogICAgZm9yKGludCBpID0gMDsgaSA8IG47IGkrKyl7CiAgICAgICAgc2NhbmYoIiVzIiwgcyk7CiAgICAgICAgaW50IGwgPSBzdHJsZW4ocyk7CiAgICAgICAgZm9yKGludCBqID0gMDsgaiA8IGw7IGorKyl7CiAgICAgICAgICAgIG1hc2tzW2ldIHw9IDEgPDwgKHNbal0gLSAnYScpOwogICAgICAgIH0KICAgIH0KICAgIAogICAgCiAgICBjb3V0IDw8IHNvbHZlKDAsIDApIDw8IGVuZGw7CiAgICAKICAgIAogICAgcmV0dXJuIDA7Cn0=