#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long mod = 1e9 + 7, i, j;
long long n, m;
set<long long> nod[200500];
bool viz[300005];
void dfs(long long q) {
  viz[q] = true;
  for (auto it = nod[q].begin(); it != nod[q].end(); it++) {
    if (viz[*it] == 0) {
      dfs(*it);
    }
  }
}
string s;
int main() {
  ifstream fin("ssm.in");
  ofstream fout("ssm.out");
  cin >> n;
  long long ans = 0;
  for (i = 1; i <= n; i++) {
    cin >> s;
    for (j = 0; j < s.size(); j++) {
      nod[i].insert(n + s[j] - 'a' + 1);
      nod[n + s[j] - 'a' + 1].insert(i);
    }
  }
  for (i = 1; i <= n; i++) {
    if (viz[i] == false) {
      dfs(i);
      ans++;
    }
  }
  cout << ans;
  return 0;
}
