#include <bits/stdc++.h>
using namespace std;
int n;
string s;
set<int> d, ans;
struct dsu {
  int p[26], sz[26];
  void init() {
    iota(p, p + 26, 0);
    fill(sz, sz + 26, 1);
  }
  int getP(int x) { return p[x] = x == p[x] ? x : getP(p[x]); }
  void mrg(int x, int y) {
    x = getP(x);
    y = getP(y);
    if (x == y) return;
    if (sz[y] > sz[x]) swap(x, y);
    sz[x] += sz[y];
    p[y] = x;
  }
} tree;
int main() {
  cin >> n;
  tree.init();
  for (int i = 0; i < n; i++) {
    cin >> s;
    for (char j : s) {
      d.insert(j - 'a');
      tree.mrg(j - 'a', s.front() - 'a');
    }
  }
  for (int i : d) ans.insert(tree.getP(i));
  cout << ans.size();
  return 0;
}
