#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> v;
void visit(int i, bool visited[]) {
  visited[i] = true;
  for (int j = 0; j < v[i].size(); j++) {
    if (!visited[v[i][j]]) visit(v[i][j], visited);
  }
}
int dfs(int n) {
  bool visited[n + 26];
  for (int i = 0; i < n + 26; i++) visited[i] = false;
  int comp = 0;
  for (int i = 26; i < n + 26; i++) {
    if (!visited[i]) {
      visit(i, visited);
      comp++;
    }
  }
  return comp;
}
int main() {
  int n;
  cin >> n;
  string a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  v.resize(26 + n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < a[i].size(); j++) {
      v[a[i][j] - 'a'].push_back(i + 26);
      v[i + 26].push_back(a[i][j] - 'a');
    }
  }
  cout << dfs(n) << endl;
}
