#include <bits/stdc++.h>
using namespace std;
const long long int INF = (long long int)2e18 + 77;
void solve() {
  int n, i;
  cin >> n;
  vector<string> v(n);
  for (i = 0; i < n; i++) {
    cin >> v[i];
  }
  bitset<26> x[n];
  set<int> s;
  for (i = 0; i < n; i++) {
    for (auto c : v[i]) x[i][c - 'a'] = 1;
    s.insert(i);
  }
  int ans = 0;
  while ((long long int)(s.size())) {
    int fst = (*s.begin());
    set<int> del;
    bitset<26> y = x[fst];
    while (true) {
      int f = 0;
      for (auto it : s) {
        if ((x[it] & y).count()) {
          f = 1;
          del.insert(it);
          y = y | x[it];
        }
      }
      for (auto it : del) s.erase(it);
      del.clear();
      if (f == 0) break;
    }
    ans++;
    for (auto it : del) s.erase(it);
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
