#include <bits/stdc++.h>
using namespace std;
vector<long long int> parent(26);
long long int find(long long int u) {
  if (parent[u] == u) return u;
  return parent[u] = find(parent[u]);
}
signed main() {
  long long int t = 1;
  while (t--) {
    for (long long int i = 0; i < 26; i++) parent[i] = i;
    long long int n;
    cin >> n;
    vector<long long int> c(26, 0);
    for (long long int i = 0; i < n; i++) {
      string s;
      cin >> s;
      for (long long int j = 0; j < s.size(); j++) {
        c[s[j] - 'a']++;
        for (long long int k = j + 1; k < s.size(); k++) {
          long long int u = s[j] - 'a', v = s[k] - 'a';
          u = find(u), v = find(v);
          if (u != v) {
            parent[u] = v;
          }
        }
      }
    }
    long long int ans = 0;
    for (long long int i = 0; i < 26; i++) {
      if (c[i] && parent[i] == i) {
        ans++;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
