#include <bits/stdc++.h>
using namespace std;
const int maxn = 55;
const int N = 30;
char c[maxn];
int f[maxn];
void init() {
  for (int i = 1; i <= 26; i++) f[i] = i;
}
int find(int x) { return f[x] == x ? x : f[x] = find(f[x]); }
void merge(int x, int y) { find(x) == find(y) ?: f[find(x)] = find(y); }
bool judge(int x, int y) { return find(x) == find(y); }
int n;
bool flag0[maxn], flag1[maxn];
int main() {
  scanf("%d", &n);
  init();
  for (int i = 1; i <= n; i++) {
    scanf("%s", c + 1);
    int len = strlen(c + 1);
    flag0[c[1] - 'a'] = 1;
    for (int j = 2; j <= len; j++) {
      flag0[c[j] - 'a'] = 1;
      if (!judge(c[j - 1] - 'a', c[j] - 'a')) merge(c[j - 1] - 'a', c[j] - 'a');
    }
  }
  int ans = 0;
  for (int i = 0; i < 26; i++)
    if (flag0[i]) flag1[find(i)] = 1;
  for (int i = 0; i < 26; i++) ans += flag1[i];
  printf("%d", ans);
}
