#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  int store[26];
  fill(store, store + 26, -1);
  int p = 1;
  bool check = false;
  int last = 0;
  for (int i = 0; i < n; i++) {
    cin >> s;
    for (int j = 0; j < s.length(); j++) {
      int idx = s[j] - 'a';
      if (store[idx] != -1) {
        last = p;
        check = true;
        p = store[idx];
        break;
      }
    }
    for (int j = 0; j < s.length(); j++) {
      int idx = s[j] - 'a';
      if (store[idx] != -1 and store[idx] != p) {
        for (int l = 0; l < 26; l++) {
          if (store[l] == store[idx] and l != idx) {
            store[l] = p;
          }
        }
      }
      store[idx] = p;
    }
    if (check) {
      p = last;
      check = false;
    } else {
      p++;
    }
  }
  map<int, int> m;
  for (int j = 0; j < 26; j++) {
    if (store[j] != -1) {
      m[store[j]]++;
    }
  }
  cout << m.size() << endl;
  return 0;
}
