#include <bits/stdc++.h>
using namespace std;
int64_t encode(string s) {
  int64_t res = 0;
  for (int64_t i = 0; i < s.length(); i++) {
    int64_t bit = s[i] - 'a';
    res |= (1 << bit);
  }
  return res;
}
void makeSet(vector<int64_t>& parent, int64_t n) {
  for (int64_t i = 0; i < n; i++) parent[i] = i;
}
int64_t findSet(int64_t v, vector<int64_t>& parent) {
  if (v == parent[v])
    return v;
  else
    return parent[v] = findSet(parent[v], parent);
}
void unionSet(int64_t a, int64_t b, vector<int64_t>& parent,
              vector<int64_t>& size) {
  a = findSet(a, parent);
  b = findSet(b, parent);
  if (a != b) {
    if (size[a] < size[b]) swap(a, b);
    parent[b] = a;
    size[a] += size[b];
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int64_t n;
  string s;
  cin >> n;
  vector<int64_t> v;
  for (int64_t i = 0; i < n; i++) {
    cin >> s;
    v.push_back(encode(s));
  }
  vector<int64_t> map[26];
  for (int64_t i = 0; i < 26; i++) {
    for (int64_t j = 0; j < n; j++) {
      if (v[j] & (1 << i)) map[i].push_back(j);
    }
  }
  vector<int64_t> parent(n), size(n, 1);
  makeSet(parent, n);
  for (int64_t i = 0; i < 26; i++) {
    if (map[i].size() > 1) {
      int64_t root = map[i][0];
      for (int64_t j = 1; j < map[i].size(); j++) {
        unionSet(root, map[i][j], parent, size);
      }
    }
  }
  for (int64_t i = 0; i < n; i++) parent[i] = findSet(i, parent);
  set<int64_t> cnt;
  for (int64_t i = 0; i < n; i++) cnt.insert(parent[i]);
  cout << cnt.size() << "\n";
  return 0;
}
