#include <bits/stdc++.h>
using namespace std;
const int maxn = 300000 + 10;
const int N = 200001;
int fa[maxn], sum[maxn];
char s[maxn];
int n;
bool f[27], fin[27];
int Find(int x) { return fa[x] != x ? fa[x] = Find(fa[x]) : x; }
void Union(int x, int y) {
  fa[x] = y;
  sum[y] += sum[x];
}
int main() {
  cin >> n;
  for (int i = 1; i <= N + 26; i++) {
    fa[i] = i;
  }
  for (int i = 1; i <= n; i++) {
    scanf("%s", s);
    int len = strlen(s);
    for (int j = 0; j < len; j++) {
      f[s[j] - 'a'] = true;
      fin[s[j] - 'a'] = true;
    }
    int tmp;
    for (int j = 0; j < 26; j++) {
      if (f[j]) {
        tmp = j;
        for (int k = j + 1; k < 26; k++) {
          if (f[k]) {
            int x = Find(N + j), y = Find(N + k);
            if (x != y) {
              Union(x, y);
            }
          }
        }
      }
    }
    memset(f, false, sizeof(f));
    sum[i] = 1;
    Union(i, fa[N + tmp]);
  }
  int ans = 0;
  for (int i = 0; i < 26; i++) {
    if (fin[i] && fa[N + i] == N + i) ans++;
  }
  cout << ans << endl;
  return 0;
}
