#include <bits/stdc++.h>
using namespace std;
std::vector<int> g[300000], visited(300000, 0);
void dfs(int v) {
  visited[v] = 1;
  for (auto i : g[v]) {
    if (!visited[i]) dfs(i);
  }
}
int main() {
  int n;
  cin >> n;
  string s;
  map<int, int> m;
  for (int i = 0; i < n; i++) {
    cin >> s;
    for (int i = 0; i < s.size(); i++) {
      m[s[i] - 96] = 1;
      for (int j = i + 1; j < s.size(); j++) {
        int p = s[i] - 96, q = s[j] - 96;
        g[p].push_back(q);
        g[q].push_back(p);
      }
    }
  }
  int ans = 0;
  for (int i = 1; i < 27; i++) {
    if (!visited[i] && m.find(i) != m.end()) {
      dfs(i);
      ans++;
    }
  }
  std::cout << ans << std::endl;
  return 0;
}
