#include <bits/stdc++.h>
using namespace std;
long long int get(vector<long long int> &parent, long long int i) {
  if (parent[i] == i) return i;
  return parent[i] = get(parent, parent[i]);
}
void Union(vector<long long int> &parent, vector<long long int> &rank,
           long long int a, long long int b) {
  a = get(parent, a);
  b = get(parent, b);
  if (rank[a] == rank[b]) rank[a]++;
  if (rank[a] > rank[b])
    parent[b] = a;
  else
    parent[a] = b;
}
signed main() {
  long long int n;
  cin >> n;
  vector<long long int> parent(27);
  vector<long long int> rank(27, 1);
  for (long long int i = 0; i <= 26; i++) parent[i] = i;
  vector<bool> total(26, false);
  vector<bool> curr(26, false);
  for (long long int j = 0; j < n; j++) {
    string str;
    cin >> str;
    for (long long int i = 0; i < 26; i++) curr[i] = false;
    for (char ch : str) {
      curr[ch - 'a'] = true;
    }
    for (long long int i = 0; i < 26; i++) {
      if (curr[i] == true) {
        total[i] = true;
        Union(parent, rank, str[0] - 'a', i);
      }
    }
  }
  long long int cnt = 0;
  for (long long int i = 0; i < 26; i++) {
    if (total[i] == true and get(parent, i) == i) cnt++;
  }
  cout << cnt << endl;
  return 0;
}
