#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n;
  cin >> n;
  string s[n];
  for (long long i = 0; i < n; i++) cin >> s[i];
  vector<long long> A[26];
  for (long long i = 0; i < n; i++) {
    long long l = s[i].length();
    for (long long j = 0; j < l; j++) A[s[i][j] - 'a'].push_back(i);
  }
  long long grp[n];
  long long num[n];
  for (long long i = 0; i < n; i++) {
    grp[i] = -1;
    num[i] = -1;
  }
  long long curr_grp = 0;
  for (long long i = 0; i < 26; i++) {
    if (A[i].empty()) continue;
    bool g = 0;
    long long req_grp = -1;
    for (long long V : A[i]) {
      if (grp[V] != -1) {
        if (g)
          num[grp[V]] = req_grp;
        else {
          g = 1;
          req_grp = grp[V];
        }
      }
    }
    if (!g) {
      req_grp = curr_grp;
      num[curr_grp] = curr_grp;
      curr_grp++;
    }
    long long curr_l = A[i].size();
    for (long long j = 0; j < curr_l; j++) grp[A[i][j]] = req_grp;
  }
  set<long long> ans;
  for (long long i = 0; i < n; i++) {
    if (num[i] != -1) ans.insert(num[i]);
  }
  cout << ans.size() << endl;
}
