#include <bits/stdc++.h>
using namespace std;
namespace Dango {
const int MAXN = 200005;
string st;
int n, fa[35], ans;
int ffind(int a) { return fa[a] == a ? a : fa[a] = ffind(fa[a]); }
int work() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> st;
    for (int j = 0; j < st.length(); j++) {
      int x = st[j] - 'a' + 1;
      if (!fa[x]) {
        fa[x] = x;
        ans++;
      }
    }
    for (int j = 1; j < st.length(); j++) {
      int x = st[j - 1] - 'a' + 1, y = st[j] - 'a' + 1;
      int a = ffind(x), b = ffind(y);
      if (a == b) continue;
      fa[a] = b;
      ans--;
    }
  }
  printf("%d", ans);
  return 0;
}
}  // namespace Dango
int main() { return Dango::work(); }
