#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
template <class T>
inline bool read(T &x) {
  x = 0;
  register char c = getchar();
  register bool f = 0;
  while (!isdigit(c)) {
    if (c == EOF) return false;
    f ^= c == '-', c = getchar();
  }
  while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  if (f) x = -x;
  return true;
}
template <class T>
inline bool reads(T &x) {
  x = "";
  register char c = getchar();
  while (c == ' ' || c == '\n' || c == '\r' || c == '\t') c = getchar();
  if (c == EOF) return false;
  while (c != ' ' && c != '\n' && c != '\r' && c != '\t' && c != EOF)
    x += c, c = getchar();
  return true;
}
template <class T>
inline void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 ^ 48);
}
template <class T>
inline T mind(T a, T b) {
  if (b < a) return b;
  return a;
}
template <class T>
inline void print(T x, char c) {
  print(x), putchar(c);
}
template <class T, class... S>
inline bool read(T &x, S &...y) {
  return read(x) && read(y...);
}
long long n, ans, rt[400005], rk[400005], fa[400005];
inline long long getr(long long x) {
  return rt[x] == x ? x : rt[x] = getr(rt[x]);
}
inline void un(long long x, long long y) {
  long long gx = getr(x), gy = getr(y);
  if (gx == gy) return;
  if (rk[gx] > rk[gy])
    rt[gy] = gx;
  else {
    rt[gx] = gy;
    if (rk[gx] == rk[gy]) rk[gy]++;
  }
}
string s;
int main() {
  read(n);
  for (long long i = 1; i <= n; i++) rt[i] = i;
  for (long long i = 1; i <= n; i++) {
    reads(s);
    for (long long j = 1; j <= 26; j++) {
      char c = 96 + j;
      if (s.find(c) != string::npos) {
        if (fa[j])
          un(i, fa[j]);
        else
          fa[j] = i;
      }
    }
  }
  for (long long i = 1; i <= n; i++)
    if (rt[i] == i) ans++;
  print(ans, '\n');
  return 0;
}
