#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 200010;
int id[26];
int p[N];
int find(int x) // 并查集
{
if (p[x] != x) p[x] = find(p[x]);
return p[x];
}
int main()
{
int n;
cin>>n;
int res=n;
for(int i=1;i<=n;i++)p[i]=i;
for(int i=1;i<=n;i++){
string s;
cin>>s;
for (int j = 0; s[j]; j ++ )
{
int c=s[j]-'a';
if(id[c]){
if(find(i)!=find(id[c])){p[find(i)]=find(id[c]);res--;}
}
else
id[c]=i;
}
}
cout<<res;
return 0;
}