// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <iomanip>
#define dibs reserve
#define OVER9000 1234567890
#define patkan 9
#define tisic 47
#define soclose 1e-9
#define pi 3.1415926535898
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define chocolate win
#define ff first
#define ss second
#define abs(x) ((x < 0)?-(x):(x))
#define uint unsigned int
#include <time.h>
// mylittlepony
using namespace std;
int lastone(int x) {return x&(x^(x-1));}
int main() {
cin.sync_with_stdio(0);
int N;
cin >> N;
vector<int> W(N,0);
for(int i =0; i < N; i++) {
string s;
vector<int> poc(26,0);
cin >> s;
for(uint j =0; j < s.length(); j++) poc[s[j]-'a']++;
for(int j =0; j < 26; j++) W[i] =(2*W[i]+(int)(poc[j] > 0));}
vector<int> A(1<<15), B(1<<15);
for(int i =0; i < min(12,N); i++) B[1<<i] =W[i];
for(int i =12; i < N; i++) A[1<<(i-12)] =W[i];
int ans =0;
for(int i =0; i < (1<<(N-1)); i++) {
int x =0, y =i;
while(y > 0) {
int a =lastone(y);
if((a>>12) > 0) x |=A[a>>12];
else x |=B[a];
y ^=a;}
if(x == (1<<26)-1) ans++;
if((x|W[N-1]) == (1<<26)-1) ans++;}
cout << ans << "\n";
return 0;}
// look at my code
// my code is amazing
Ly8gaW9zdHJlYW0gaXMgdG9vIG1haW5zdHJlYW0KI2luY2x1ZGUgPGNzdGRpbz4KLy8gYml0Y2ggcGxlYXNlCiNpbmNsdWRlIDxpb3N0cmVhbT4KI2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPHNldD4KI2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPHF1ZXVlPgojaW5jbHVkZSA8c3RhY2s+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxjbWF0aD4KI2lu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pKyspIEJbMTw8aV0gPVdbaV07CiAgICBmb3IoaW50IGkgPTEyOyBpIDwgTjsgaSsrKSBBWzE8PChpLTEyKV0gPVdbaV07CiAKICAgIGludCBhbnMgPTA7CiAgICBmb3IoaW50IGkgPTA7IGkgPCAoMTw8KE4tMSkpOyBpKyspIHsKICAgICAgICBpbnQgeCA9MCwgeSA9aTsKICAgICAgICB3aGlsZSh5ID4gMCkgewogICAgICAgICAgICBpbnQgYSA9bGFzdG9uZSh5KTsKICAgICAgICAgICAgaWYoKGE+PjEyKSA+IDApIHggfD1BW2E+PjEyXTsKICAgICAgICAgICAgZWxzZSB4IHw9QlthXTsKICAgICAgICAgICAgeSBePWE7fQogICAgICAgIGlmKHggPT0gKDE8PDI2KS0xKSBhbnMrKzsKICAgICAgICBpZigoeHxXW04tMV0pID09ICgxPDwyNiktMSkgYW5zKys7fQogICAgY291dCA8PCBhbnMgPDwgIlxuIjsKICAgIHJldHVybiAwO30KIAovLyBsb29rIGF0IG15IGNvZGUKLy8gbXkgY29kZSBpcyBhbWF6aW5n