#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const int N = 200003;
long long mod = 1e9 + 7;
int sze[26], par[26];
bool seen[26];
int root(int x) {
  while (x != par[x]) {
    par[x] = par[par[x]];
    x = par[x];
  }
  return x;
}
void unite(int x, int y) {
  int rx = root(x), ry = root(y);
  if (sze[rx] > sze[ry]) swap(rx, ry);
  par[rx] = par[ry];
  sze[ry] += sze[rx];
  sze[rx] = 0;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int i, j, l;
  string s[n + 1];
  for (i = 1; i <= n; ++i) cin >> s[i];
  for (i = 0; i < 26; ++i) par[i] = i, sze[i] = 1, seen[i] = 0;
  for (i = 1; i <= n; ++i) {
    j = s[i].size();
    for (l = 1; l < j; ++l)
      unite(s[i][l] - 'a', s[i][0] - 'a'), seen[s[i][l] - 'a'] = 1;
    seen[s[i][0] - 'a'] = 1;
  }
  unordered_set<int> st;
  for (i = 0; i < 26; ++i) {
    if (seen[i]) {
      j = root(i);
      if (!st.count(j)) st.insert(j);
    }
  }
  cout << st.size();
  return 0;
}
