#include <bits/stdc++.h>
using namespace std;
vector<int> phi;
vector<int> spf;
void banao(int n) {
  phi.resize(n + 1);
  for (int i = 0; i < n + 1; i++) phi[i] = i;
  for (int k = 2; k < n + 1; k++) {
    if (phi[k] == k) {
      phi[k] = k - 1;
      for (int i = 2 * k; i <= n; i += k) {
        phi[i] = (phi[i] / k) * (k - 1);
      }
    }
  }
}
bool isprime(int n) {
  if (phi[n] == n - 1)
    return true;
  else
    return false;
}
void pfactor(int n) {
  spf.resize(n + 1, 1);
  for (int i = 2; i < n + 1; i++) spf[i] = i;
  for (int i = 4; i <= n; i += 2) spf[i] = 2;
  for (int i = 3; i * i <= n; i++) {
    if (spf[i] == i) {
      for (int j = i * i; j <= n; j += i)
        if (spf[j] == j) spf[j] = i;
    }
  }
}
vector<int> tpf(int x) {
  vector<int> ret;
  while (x != 1) {
    ret.push_back(spf[x]);
    x = x / spf[x];
  }
  return ret;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(10);
  int Test = 1;
  while (Test--) {
    int n;
    cin >> n;
    map<int, vector<bool>> m;
    map<int, bool> mp;
    map<int, bool> ms;
    for (int i = 0; i < n; i++) {
      string s;
      cin >> s;
      m[i].resize(26, false);
      for (int j = 0; j < s.length(); j++) {
        m[i][s[j] - 'a'] = true;
        mp[s[j] - 'a'] = true;
      }
    }
    int ans = 0;
    for (int i = 0; i < 26; i++) {
      if (mp[i] == true) {
        ans++;
        queue<int> q;
        q.push(i);
        mp[i] = false;
        while (!q.empty()) {
          int x = q.front();
          q.pop();
          for (int j = 0; j < n; j++) {
            if (ms[j] == false && m[j][x] == true) {
              ms[j] = true;
              for (int k = 0; k < 26; k++) {
                if (m[j][k] && mp[k]) {
                  q.push(k);
                  mp[k] = false;
                }
              }
            }
          }
        }
      }
    }
    cout << ans << endl;
  }
}
