#include <bits/stdc++.h>
using namespace std;
inline int lowbit(int x) { return x & (-x); }
inline int read() {
  int X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const double pi = acos(-1.0);
const double eps = 1e-8;
const int maxn = 1e6 + 10;
const int maxp = 1e3 + 10;
const long long INF = 0x3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
int n;
char s[100];
int vis[30];
int f[30];
void init() {
  for (int i = 0; i < 30; ++i) f[i] = i;
}
int Find(int x) {
  if (x == f[x]) return x;
  return f[x] = Find(f[x]);
}
void Union(int a, int b) {
  a = Find(a), b = Find(b);
  f[a] = b;
}
int main() {
  init();
  n = read();
  for (int i = 0; i < n; ++i) {
    scanf("%s", s);
    int len = strlen(s);
    vis[s[0] - 'a'] = 1;
    for (int j = 1; j < len; ++j) {
      vis[s[j] - 'a'] = 1;
      Union(s[j] - 'a', s[j - 1] - 'a');
    }
  }
  int res = 0;
  set<int> q;
  for (int i = 0; i < 26; ++i) {
    if (vis[i] == 0) continue;
    if (q.count(Find(i)) == 0) {
      q.insert(Find(i));
      res++;
    }
  }
  printf("%d\n", res);
  return 0;
}
