#include <bits/stdc++.h>
using namespace std;
int val[100], par[100], ck[100], vis[100];
int _find(int x) {
  if (par[x] == x)
    return x;
  else
    return par[x] = _find(par[x]);
}
void make(int x, int y) {
  val[x] += val[y];
  par[y] = par[x];
}
int main() {
  int n, x;
  while (cin >> n) {
    int x1;
    memset(vis, 0, sizeof(vis));
    memset(par, -1, sizeof(par));
    for (int i = 1; i <= n; i++) {
      string s;
      cin >> s;
      int x = s[0] - 'a' + 1;
      if (par[x] == -1) {
        par[x] = x;
        val[x] = +1;
        x1 = x;
      } else
        x1 = _find(x);
      for (int j = 1; j <= (s.size() - 1); j++) {
        int x = s[j] - 'a' + 1;
        int y1;
        if (par[x] == -1) {
          par[x] = x;
          val[x] += 1;
          y1 = x;
        } else
          y1 = _find(x);
        if (x1 == y1) continue;
        make(x1, y1);
      }
    }
    int cnt = 0;
    for (int i = 1; i <= 26; i++) {
      int x = 0;
      if (par[i] != -1) {
        x = _find(i);
        if (vis[x] == 0) {
          vis[x] = 1;
          cnt++;
        }
      }
    }
    cout << cnt << endl;
  }
}
