#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
template <class T1>
void deb(T1 e1) {
  cout << e1 << endl;
}
template <class T1, class T2>
void deb(T1 e1, T2 e2) {
  cout << e1 << " " << e2 << endl;
}
template <class T1, class T2, class T3>
void deb(T1 e1, T2 e2, T3 e3) {
  cout << e1 << " " << e2 << " " << e3 << endl;
}
template <class T1, class T2, class T3, class T4>
void deb(T1 e1, T2 e2, T3 e3, T4 e4) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << endl;
}
template <class T1, class T2, class T3, class T4, class T5>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << endl;
}
template <class T1, class T2, class T3, class T4, class T5, class T6>
void deb(T1 e1, T2 e2, T3 e3, T4 e4, T5 e5, T6 e6) {
  cout << e1 << " " << e2 << " " << e3 << " " << e4 << " " << e5 << " " << e6
       << endl;
}
template <class T>
T gcd(const T a, const T b) {
  return (b ? gcd<T>(b, a % b) : a);
}
template <class T>
T lcm(const T a, const T b) {
  return (a / gcd<T>(a, b) * b);
}
struct node {
  long long x, y;
  node() {}
  node(long long x, long long y) : x(x), y(y) {}
  bool operator<(const node& p) const { return x < p.x; }
};
bool vis[26][26];
bool is[26];
bool ck[26];
void dfs(long long id) {
  if (ck[id]) return;
  ck[id] = 1;
  for (long long i = 0; i < 26; i++) {
    if (vis[id][i]) dfs(i);
  }
}
int main() {
  long long i, j, k, l, t, n, m, l1, l2, x, y, z;
  scanf("%lld", &n);
  memset(vis, 0, sizeof(vis));
  memset(ck, 0, sizeof(ck));
  memset(is, 0, sizeof(is));
  for (i = 0; i < n; i++) {
    string s;
    cin >> s;
    bool c[26];
    memset(c, 0, sizeof(c));
    for (char d : s) {
      x = d - 'a';
      c[x] = 1;
      is[x] = 1;
    }
    for (j = 0; j < 26; j++) {
      if (!c[j]) continue;
      for (k = 0; k < 26; k++) {
        if (!c[k]) continue;
        vis[j][k] = 1;
      }
    }
  }
  long long ans = 0;
  for (i = 0; i < 26; i++) {
    if (!is[i]) continue;
    if (ck[i]) continue;
    ans++;
    dfs(i);
  }
  deb(ans);
  return 0;
}
