#include <bits/stdc++.h>
using namespace std;
long long int n, m, k, g, mx, mn, res, c, x, y, z, w, p, q, r, l, s, t;
vector<long long int> G[200005];
long long int vis[30];
map<long long int, long long int> mp;
void dfs(long long int u) {
  vis[u] = 1;
  for (long long int v : G[u]) {
    if (!vis[v]) {
      dfs(v);
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    string s;
    cin >> s;
    long long int u = s[0] - 'a';
    mp[u] = 1;
    for (long long int j = 1; j < s.size(); j++) {
      long long int v = s[j] - 'a';
      G[u].push_back(v);
      G[v].push_back(u);
    }
  }
  res = 0;
  for (long long int i = 0; i < 26; i++) {
    if (mp[i] and !vis[i]) {
      res++;
      dfs(i);
    }
  }
  cout << res;
  return 0;
}
