#include <bits/stdc++.h>
using namespace std;
const long long N = 200001;
long long par[N], siz[N];
long long f(long long n) {
  if (n == par[n])
    return n;
  else
    return par[n] = f(par[n]);
}
void u(long long a, long long b) {
  a = f(a);
  b = f(b);
  if (a != b) {
    if (siz[a] < siz[b]) swap(a, b);
    par[b] = a;
    siz[a] += siz[b];
  }
}
void solve() {
  long long n;
  cin >> n;
  string s[n + 1];
  for (long long i = 1; i <= n; i++) {
    cin >> s[i];
    par[i] = i;
    siz[i] = 1;
  }
  for (char c = 'a'; c <= 'z'; c++) {
    vector<long long> v;
    for (long long i = 1; i <= n; i++) {
      for (long long j = 0; j < s[i].length(); j++) {
        if (s[i][j] == c) v.push_back(i);
      }
    }
    for (long long i = 1; i < v.size(); i++) u(v[i], v[i - 1]);
  }
  set<long long> se;
  for (long long i = 1; i <= n; i++) {
    long long x = f(i);
    se.insert(x);
  }
  cout << se.size() << "\n";
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
