#include <bits/stdc++.h>
const int MAXN = 2e5 + 5;
const int LEN = 500;
char str[LEN];
int groups[LEN], n, ans;
struct UnionFindSet {
  int f[MAXN];
  inline void Setup() {
    for (int i = 1; i < MAXN; i++) f[i] = i;
  }
  inline int findf(int x) { return f[x] == x ? x : f[x] = findf(f[x]); }
  inline void merge(int x, int y) {
    int fx = findf(x), fy = findf(y);
    if (fx != fy) f[fy] = fx;
  }
} ufs;
int main(int argc, char **argv) {
  ufs.Setup();
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", str);
    int len = strlen(str);
    for (int j = 0; j < len; j++)
      if (!groups[str[j]])
        groups[str[j]] = i;
      else
        ufs.merge(groups[str[j]], i);
  }
  for (int i = 1; i <= n; i++)
    if (ufs.f[i] == i) ans++;
  printf("%d\n", ans);
  return 0;
}
