#include <bits/stdc++.h>
using namespace std;
long long int GC(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return GC(b, a % b);
}
long long int inv_gc(long long int a, long long int b) {
  return a / GC(a, b) * b;
}
long long int Ceil(long long int a, long long int b) {
  return a / b + (a % b != 0);
}
long long int fastModExp(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % 1000000007;
    a = (a * a) % 1000000007;
    b = b >> 1;
  }
  return res;
}
map<int, int> par, rk;
void make_set() {
  for (char i = 'a'; i <= 'z'; i++) {
    par[i] = i;
    rk[i] = 1;
  }
}
int find(char x) {
  if (x == par[x]) return x;
  char p = find(par[x]);
  par[x] = p;
  return p;
}
int uni(char x, char y) {
  char p1 = find(x);
  char p2 = find(y);
  if (p1 == p2) return 0;
  if (rk[p1] > rk[p2]) {
    par[p2] = p1;
    rk[p1] += rk[p2];
  } else {
    par[p1] = p2;
    rk[p2] += rk[p1];
  }
  return 1;
}
map<char, int> mpx;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  make_set();
  int n;
  vector<string> v;
  cin >> n;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    v.push_back(s);
    if (s.length() > 1) {
      for (int i = 0; i < s.length() - 1; i++) int r = uni(s[i], s[i + 1]);
    }
  }
  for (int i = 0; i < v.size(); i++) {
    mpx[find(v[i][0])] = 1;
  }
  long long int count = 0;
  for (auto it = mpx.begin(); it != mpx.end(); it++)
    if (it->second == 1) {
      count++;
    }
  cout << count << endl;
  return 0;
}
