#include <bits/stdc++.h>
using namespace std;
vector<int> parent;
vector<int> size_set;
void make_set(int v) { parent[v] = v; }
int find_set(int v) {
  if (v == parent[v]) return v;
  return parent[v] = find_set(parent[v]);
}
bool same(int a, int b) { return find_set(a) == find_set(b); }
void unite(int a, int b) {
  a = find_set(a);
  b = find_set(b);
  if (a == b) return;
  parent[b] = a;
}
void solve() {
  int n;
  cin >> n;
  set<int> ans;
  set<int> symb;
  vector<string> vec(n);
  for (auto& el : vec) {
    cin >> el;
    for (auto& l : el) symb.insert(l - 'a');
  }
  parent.resize(26);
  for (auto& el : symb) make_set(el);
  for (auto& el : vec) {
    string str = el;
    for (int i = 1; i < str.size(); i++) unite(str[i] - 'a', str[0] - 'a');
  }
  for (auto& el : symb) find_set(el);
  for (auto& el : symb) ans.emplace(parent[el]);
  cout << ans.size();
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
