#include <bits/stdc++.h>
using namespace std;
int parent(int x, vector<int> &v) {
  return v[x] = (v[x] == x ? x : parent(v[x], v));
}
void u(int x, int y, vector<int> &v, vector<int> &r) {
  x = parent(x, v);
  y = parent(y, v);
  if (r[x] == r[y]) {
    if (x == y) {
      return;
    }
    r[x]++;
  }
  if (r[x] > r[y]) {
    v[y] = x;
  } else {
    v[x] = y;
  }
  return;
}
int main() {
  int n;
  scanf("%d\n", &n);
  vector<int> v(26, -1);
  vector<int> r(26);
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    if (v[s[0] - 'a'] == -1) {
      v[s[0] - 'a'] = s[0] - 'a';
    }
    for (int i = 1; i < (int)s.size(); i++) {
      if (v[s[i] - 'a'] == -1) {
        v[s[i] - 'a'] = s[i] - 'a';
      }
      u(s[i] - 'a', s[0] - 'a', v, r);
    }
  }
  unordered_map<int, int> h;
  for (int i = 0; i < 26; i++) {
    if (v[i] != -1) {
      h[parent(v[i], v)] = 1;
    }
  }
  cout << h.size();
  return 0;
}
