#include <bits/stdc++.h>
using namespace std;
void print(vector<long long int> &v) {
  long long int n = v.size();
  for (long long int i = 0; i < n; i++) cout << v[i] << " ";
  cout << "\n";
  ;
  return;
}
vector<long long int> parent(200001);
vector<long long int> size1(200001);
long long int find(long long int a) {
  if (a == parent[a]) return a;
  return parent[a] = find(parent[a]);
}
void union1(long long int a, long long int b) {
  long long int a1 = find(a);
  long long int b1 = find(b);
  if (a1 == b1) return;
  long long int t1 = size1[a1];
  long long int t2 = size1[b1];
  if (t1 < t2) {
    parent[a1] = b1;
    size1[b1] += size1[a1];
  } else {
    parent[b1] = a1;
    size1[a1] += size1[b1];
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int n;
  cin >> n;
  for (long long int i = 0; i < n + 1; i++) {
    parent[i] = i;
    size1[i] = 1;
  }
  vector<string> v(n);
  vector<vector<bool> > ar(n, vector<bool>(26, 0));
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
    long long int p = v[i].length();
    for (long long int j = 0; j < p; j++) {
      ar[i][v[i][j] - 'a'] = 1;
    }
  }
  for (long long int j = 0; j < 26; j++) {
    long long int prev = -1;
    for (long long int i = 0; i < n; i++) {
      if (ar[i][j] == 1) {
        if (prev == -1)
          prev = i;
        else {
          union1(prev, i);
        }
      }
    }
  }
  set<long long int> st;
  for (long long int i = 0; i < n; i++) {
    st.insert(find(i));
  }
  cout << st.size() << "\n";
  ;
  return 0;
}
