#include <bits/stdc++.h>
using namespace std;
long long size[200005];
long long parent[200005];
void make_set(long long v) {
  parent[v] = v;
  size[v] = 1;
  return;
}
long long find_set(long long v) {
  if (parent[v] == v) {
    return v;
  } else {
    parent[v] = find_set(parent[v]);
    return parent[v];
  }
}
void merge_set(long long u, long long v) {
  u = find_set(u);
  v = find_set(v);
  if (v != u) {
    if (size[u] < size[v]) {
      parent[u] = v;
      size[v] += size[u];
    } else {
      parent[v] = u;
      size[u] += size[v];
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  for (long long i = 0; i <= n; i++) {
    parent[i] = i;
    size[i] = 1;
  }
  vector<long long> graph[28];
  for (long long i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (long long j = 0; j < s.length(); j++) {
      long long number = s[j] - 'a';
      graph[number].push_back(i);
    }
  }
  for (long long i = 0; i < 26; i++) {
    if (graph[i].size() > 1) {
      for (long long it = 1; it < graph[i].size(); it++) {
        merge_set(graph[i][0], graph[i][it]);
      }
    }
  }
  set<long long> s;
  for (long long i = 0; i < n; i++) {
    s.insert(find_set(i));
  }
  cout << s.size() << "\n";
}
