#include <bits/stdc++.h>
using namespace std;
vector<int> p(26);
vector<bool> ok(26, false);
void mrg(int a, int b) {
  for (int i = 0; i < 26; i++) {
    if (p[i] == b) {
      p[i] = a;
    }
  }
}
int main() {
  for (int i = 0; i < 26; i++) {
    p[i] = i;
  }
  int n;
  cin >> n;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    ok[s[0] - 'a'] = true;
    for (int j = 1; j < s.size(); j++) {
      mrg(p[s[0] - 'a'], p[s[j] - 'a']);
      ok[s[j] - 'a'] = true;
    }
  }
  set<int> ans;
  for (int i = 0; i < 26; i++) {
    if (ok[i]) ans.insert(p[i]);
  }
  cout << ans.size();
  return 0;
}
