#include <bits/stdc++.h>
using namespace std;
int par[105], m[105];
bool vis[105];
int root(int u) { return par[u] < 0 ? u : par[u] = root(par[u]); }
void Union(int u, int v) {
  if ((u = root(u)) == (v = root(v))) return;
  if (par[u] < par[v]) {
    par[u] += par[v];
    par[v] = u;
  } else {
    par[v] += par[u];
    par[u] = v;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  for (int i = 1; i < 100; i++) par[i] = -1;
  while (t--) {
    string s;
    cin >> s;
    for (int i = 0; s[i]; i++) {
      int id = s[i] - 'a' + 1;
      m[id] = 1;
    }
    for (int i = 0; i < s.length() - 1; i++) {
      int u = s[i] - 'a' + 1;
      int v = s[i + 1] - 'a' + 1;
      Union(u, v);
    }
  }
  int cnt = 0;
  for (int i = 1; i <= 26; i++)
    if (m[i] != 0) {
      if (!vis[root(i)]) cnt++;
      vis[root(i)] = true;
    }
  cout << cnt;
}
