#include <bits/stdc++.h>
using namespace std;
long long int p[26];
bool vis[26];
long long int get_par(long long int node) {
  if (p[node] == node) {
    return node;
  }
  return p[node] = get_par(p[node]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  for (long long int i = 0; i < 26; i++) {
    p[i] = i;
  }
  long long int n;
  cin >> n;
  for (long long int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    sort(s.begin(), s.end());
    long long int par = get_par(s[0] - 'a');
    for (auto it : s) {
      vis[it - 'a'] = 1;
      long long int p1 = get_par(it - 'a');
      p[p1] = par;
    }
  }
  long long int cnt = 0;
  for (long long int i = 0; i < 26; i++) {
    if (p[i] == i && vis[i]) {
      cnt++;
    }
  }
  cout << cnt << "\n";
}
