#include <bits/stdc++.h>
using namespace std;
long long par[27];
long long parent(long long x) {
  while (x != par[x]) {
    par[x] = par[par[x]];
    x = par[x];
  }
  return x;
}
void uni(long long x, long long y) {
  long long px = parent(x);
  long long py = parent(y);
  par[y] = px;
}
int main() {
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    set<long long> st;
    for (long long i = 0; i < 27; i++) par[i] = i;
    for (long long i = 0; i < n; i++) {
      string s;
      cin >> s;
      st.insert(s[0] - 'a');
      for (long long i = 1; i < s.length(); i++) {
        st.insert(s[i] - 'a');
        uni(s[0] - 'a', s[i] - 'a');
      }
    }
    long long ans = 0;
    for (long long i = 0; i < 26; i++)
      if (parent(i) == i && st.find(i) != st.end()) ans++;
    cout << ans << endl;
  }
  return 0;
}
