#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int n, curr;
int p[29];
string s[200009];
set<int> se;
int get(int node) {
  if (p[node] == node) return node;
  return p[node] = get(p[node]);
}
void merge(int a, int b) {
  int A = get(a);
  int B = get(b);
  if (A > B)
    p[B] = A;
  else
    p[A] = B;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cin >> n;
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 0; i < 26; i++) p[i] = i;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j < s[i].size(); j++) {
      merge(s[i][j] - 'a', s[i][j - 1] - 'a');
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < s[i].size(); j++) {
      se.insert(get(s[i][j] - 'a'));
    }
  }
  cout << se.size() << endl;
}
