#include <bits/stdc++.h>
using namespace std;
int n, b[29], d[29], i, j, s;
string a;
int dsu(int x) {
  if (d[x] == x) return x;
  return d[x] = dsu(d[x]);
}
int main() {
  ios::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (i = 0; i < 26; i++) d[i] = i;
  for (i = 0; i < n; i++) {
    cin >> a;
    sort(a.begin(), a.end());
    for (j = 0; j < a.size(); j++) b[a[j] - 'a'] = 1;
    for (j = a.size() - 1; j > 0; j--) d[dsu(a[j] - 'a')] = dsu(a[j - 1] - 'a');
  }
  for (i = 0; i < 26; i++)
    if (d[i] == i && b[i]) s++;
  cout << s;
  return 0;
}
