#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000000 + 7;
long long find(long long x, long long parent[]) {
  if (parent[x] == x) {
    return x;
  }
  parent[x] = find(parent[x], parent);
  return parent[x];
}
void unionfind(long long x, long long y, long long parent[]) {
  long long parentx = find(x, parent);
  long long parenty = find(y, parent);
  parent[parentx] = parenty;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long T;
  T = 1;
start:
  while (T--) {
    long long n;
    cin >> n;
    bool count[26] = {0};
    long long parent[26];
    for (long long i = 0; i < 26; i++) {
      parent[i] = i;
    }
    for (long long i = 0; i < n; i++) {
      string s;
      cin >> s;
      count[s[0] - 'a'] = true;
      for (long long i = 1; i < s.size(); i++) {
        count[s[i] - 'a'] = true;
        if (find(s[i] - 'a', parent) != find(s[i - 1] - 'a', parent)) {
          unionfind(s[i] - 'a', s[i - 1] - 'a', parent);
        }
      }
    }
    long long temp[26];
    for (long long i = 0; i < 26; i++) {
      temp[i] = find(i, parent);
    }
    set<long long> s;
    for (long long i = 0; i < 26; i++) {
      s.insert(temp[i]);
    }
    long long nu = 0;
    for (long long i = 0; i < 26; i++) {
      if (count[i] == false) {
        nu++;
      }
    }
    cout << s.size() - nu << endl;
  }
  return 0;
}
