#include <bits/stdc++.h>
using namespace std;
int root[1000005], weight[1000005];
vector<int> vec[26];
int findroot(int x) {
  while (x != root[x]) {
    root[x] = root[root[x]];
    x = root[x];
  }
  return x;
}
void merge(int x, int y) {
  x = findroot(x);
  y = findroot(y);
  if (x == y) return;
  if (weight[x] > weight[y])
    weight[x] += weight[y], root[y] = x;
  else
    weight[y] += weight[x], root[x] = y;
}
int main() {
  int n, i, j, ans = 0;
  cin >> n;
  string s;
  for (i = 0; i < n; i++) {
    root[i] = i;
    weight[i] = 1;
  }
  for (i = 0; i < n; i++) {
    cin >> s;
    for (char c : s) vec[c - 'a'].push_back(i);
  }
  for (i = 0; i < 26; i++) {
    for (j = 1; j < vec[i].size(); j++) merge(vec[i][j - 1], vec[i][j]);
  }
  for (i = 0; i < n; i++)
    if (root[i] == i) ans++;
  cout << ans;
}
