#include <bits/stdc++.h>
using namespace std;
const int sz = 2e5 + 7;
const long long mod = 998244353;
const long long inf = 1e18;
int n;
int parent[26];
int find_set(int v) {
  while (parent[v] != v) v = parent[v];
  return v;
}
void union_set(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a < b)
    parent[b] = a;
  else
    parent[a] = b;
}
int main() {
  cin >> n;
  int vis[26]{0};
  for (int i = 0; i < 26; i++) parent[i] = i;
  for (int i = 0; i < n; i++) {
    string x;
    cin >> x;
    set<int> temp;
    for (int j = 0; j < x.size(); j++) {
      vis[x[j] - 'a'] = 1;
      temp.insert(x[j] - 'a');
    }
    int p = 0, temp2;
    for (auto a : temp) {
      if (p) union_set(a, temp2);
      temp2 = a;
      p++;
    }
  }
  set<int> s2;
  for (int i = 0; i < 26; i++) {
    if (vis[i]) s2.insert(find_set(i));
  }
  cout << s2.size();
}
