#include <bits/stdc++.h>
using namespace std;
const long long Linf = 0x7f7f7f7f7f7f7f7f;
const int Inf = 0x3f3f3f3f;
const int MAXN = 2e5 + 10;
map<char, int> mp;
int n, fa[MAXN], tot;
string str[MAXN];
int find(int x) {
  if (fa[x] == x)
    return x;
  else
    return fa[x] = find(fa[x]);
}
int main() {
  cin >> n;
  for (int i = 0; i < 26; i++) fa[i] = i;
  for (int i = 1; i <= n; i++) {
    cin >> str[i];
    for (auto ch : str[i])
      if (!mp[ch]) mp[ch] = ++tot;
  }
  for (int i = 1; i <= n; i++) {
    string s = str[i];
    int fl = -1;
    for (int j = 0; j < (int)s.size(); j++) {
      if (fl == -1) {
        fl = s[j];
        continue;
      }
      if (find(mp[fl]) == find(mp[s[j]])) continue;
      fa[find(mp[fl])] = find(mp[s[j]]);
    }
  }
  set<int> cnt;
  for (auto x : mp) {
    cnt.insert(find(x.second));
  }
  cout << cnt.size();
  return 0;
}
