#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
char a[N][60];
int f[N], b[N], cnt = 0;
int get(int x) {
  if (f[x] == x) return x;
  return f[x] = get(f[x]);
}
int main() {
  int m, t, n, ans = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) f[i] = i;
  for (int i = 1; i <= n; i++) {
    scanf("%s", a[i] + 1);
  }
  for (int j = 0; j <= 25; j++) {
    char ch = 'a' + j;
    int flag = 1, cur = 0, p;
    for (int i = 1; i <= n; i++) {
      int len = strlen(a[i] + 1);
      for (int k = 1; k <= len; k++) {
        if (a[i][k] == ch && flag) {
          flag = 0;
          cur = i;
          p = get(i);
          cur = p;
          break;
        } else if (a[i][k] == ch) {
          int p = get(cur), q = get(i);
          f[p] = q;
          break;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) b[i] = get(i);
  sort(b + 1, b + 1 + n);
  for (int i = 1; i <= n; i++) {
    if (i == 1 || b[i] != b[i - 1]) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
