#include <bits/stdc++.h>
using namespace std;
int parent(int k, int ust[]) {
  if (ust[k] == k) return k;
  return ust[k] = parent(ust[k], ust);
}
int main() {
  int n;
  cin >> n;
  int ust[n];
  for (int i = 0; i < n; i++) ust[i] = i;
  int all[26];
  for (int i = 0; i < 26; i++) all[i] = -1;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < s.length(); j++) {
      if (all[s[j] - 'a'] == -1)
        all[s[j] - 'a'] = i;
      else {
        int par1 = parent(i, ust);
        int par2 = parent(all[s[j] - 'a'], ust);
        ust[par1] = par2;
      }
    }
  }
  int counter = 0;
  for (int i = 0; i < n; i++)
    if (ust[i] == i) counter++;
  printf("%d", counter);
  return 0;
}
