#include <bits/stdc++.h>
using namespace std;
const int INF = 2e9 + 10;
const long long inf = 9e18 + 10;
const int MO = 1e9 + 7;
const double eps = 1e-3;
const int max_n = 2e5 + 5;
char s[max_n][55];
int fa[max_n], v[max_n], Y[max_n];
void init(int n) {
  for (register int i = (1); i <= (n); ++i) fa[i] = i;
}
int get(int x) { return x == fa[x] ? x : fa[x] = get(fa[x]); }
void merge(int x, int y) {
  x = get(x), y = get(y);
  if (x != y) fa[x] = y;
}
int main() {
  int n;
  scanf("%d", &n);
  init(26);
  for (register int i = (1); i <= (n); ++i) {
    scanf("%s", s[i] + 1);
    for (int j = 1; s[i][j]; j += 1) v[s[i][j] - 'a' + 1] = 1;
  }
  for (register int i = (1); i <= (n); ++i) {
    int len = strlen(s[i] + 1);
    for (register int j = (1); j <= (len - 1); ++j) {
      int x = s[i][j] - 'a' + 1, y = s[i][j + 1] - 'a' + 1;
      merge(x, y);
    }
  }
  int ans = 0;
  for (register int i = (1); i <= (26); ++i) {
    if (v[i]) {
      Y[get(i)] = 1;
    }
  }
  for (register int i = (1); i <= (26); ++i)
    if (Y[i]) ans += 1;
  printf("%d\n", ans);
  return 0;
}
