#include <bits/stdc++.h>
using namespace std;
struct UF {
  vector<int> e;
  vector<set<char> > vs;
  UF(int n) : e(n, -1) { vs.resize(n); }
  bool same_set(int a, int b) { return find(a) == find(b); }
  int size(int x) { return -e[find(x)]; }
  int find(int x) { return e[x] < 0 ? x : e[x] = find(e[x]); }
  pair<int, int> join(int a, int b) {
    a = find(a), b = find(b);
    if (a == b) return make_pair(a, b);
    if (e[a] > e[b]) swap(a, b);
    e[a] += e[b];
    e[b] = a;
    for (auto it = vs[b].begin(); it != vs[b].end(); ++it) {
      vs[a].insert(*it);
    }
    return make_pair(a, b);
  }
};
int main() {
  int n;
  cin >> n;
  vector<string> pwds(n);
  set<int> reps;
  UF uf(n);
  for (int i = 0; i < n; ++i) {
    cin >> pwds[i];
    set<char> pchars;
    for (int j = 0; j < pwds[i].length(); ++j) {
      pchars.insert(pwds[i][j]);
    }
    uf.vs[i] = pchars;
    bool joined = false;
    vector<int> to_remove;
    for (auto it = reps.begin(); it != reps.end(); ++it) {
      int rep = *it;
      if (rep == i) continue;
      set<char> st = uf.vs[rep];
      bool can_join = false;
      for (auto it2 = pchars.begin(); it2 != pchars.end(); ++it2) {
        if (st.find(*it2) != st.end()) {
          can_join = true;
        }
      }
      if (can_join) {
        pair<int, int> p = uf.join(rep, i);
        to_remove.push_back(p.second);
        joined = true;
      }
    }
    reps.insert(i);
    for (int j = 0; j < to_remove.size(); ++j) {
      reps.erase(to_remove[j]);
    }
  }
  cout << reps.size() << endl;
}
