#include <bits/stdc++.h>
using namespace std;
string p[200005];
int pre[60];
int finds(int x) { return pre[x] == x ? x : pre[x] = finds(pre[x]); }
void merges(int x, int y) {
  int fx = finds(x), fy = finds(y);
  if (fx != fy) pre[fy] = fx;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int ans = n;
  for (int i = 0; i <= 50; i++) pre[i] = i;
  for (int i = 1; i <= n; i++) {
    cin >> p[i];
    int x = p[i][0] - 'a';
    for (int j = 1; j < p[i].size(); j++) {
      int y = p[i][j] - 'a';
      merges(x, y);
    }
  }
  set<int> s;
  for (int i = 1; i <= n; i++) s.insert(finds(p[i][0] - 'a'));
  cout << s.size() << endl;
  return 0;
}
