#include <bits/stdc++.h>
using namespace std;
void dfs(vector<int> v[], int u, vector<bool>& vis) {
  vis[u] = true;
  for (auto i : v[u]) {
    if (vis[i] == false) dfs(v, i, vis);
  }
}
int main() {
  int n;
  cin >> n;
  vector<int> v[n + 26];
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (auto j : s) {
      v[i].push_back(n + j - 'a');
      v[n + j - 'a'].push_back(i);
    }
  }
  vector<bool> vis(n + 26, false);
  int count = 0;
  for (int i = 0; i < n + 26; i++) {
    if (vis[i] == false and v[i].size() > 0) {
      dfs(v, i, vis);
      count++;
    }
  }
  cout << count << endl;
  return 0;
}
