#include <bits/stdc++.h>
using namespace std;
int parent[27];
int siz[27];
void make(int i) {
  parent[i] = i;
  siz[i] = 1;
}
int find(int v) {
  if (v == parent[v]) return v;
  return parent[v] = find(parent[v]);
}
void make_union(int a, int b) {
  int u = find(a);
  int v = find(b);
  if (u != v) {
    if (siz[u] < siz[v]) swap(u, v);
    parent[v] = u;
    siz[u] += siz[v];
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  int ans = 0;
  vector<bool> visited(27, false);
  for (int i = 0; i < 26; i++) parent[i] = -1;
  for (int k = 0; k < n; k++) {
    string s;
    cin >> s;
    for (int l = 0; l < (int)s.length(); l++) {
      if (!visited[s[l] - 'a']) {
        make(s[l] - 'a');
        visited[s[l] - 'a'] = true;
      }
    }
    for (int i = 1; i < (int)s.length(); i++) {
      make_union(s[i] - 'a', s[i - 1] - 'a');
    }
  }
  for (int i = 0; i < 26; i++) {
    if (parent[i] == i) {
      ans++;
    }
  }
  cout << ans << endl;
}
