#include <bits/stdc++.h>
using namespace std;
set<int> adj[2000027];
vector<bool> visited(2000027);
int how_many = 0;
void dfs(int u, bool ok) {
  if (!visited[u]) {
    if (ok) {
      how_many++;
    }
    visited[u] = true;
    for (auto v : adj[u]) {
      dfs(v, false);
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (char c : s) {
      adj[i].insert(2000000 + c - 'a' + 1);
      adj[2000000 + c - 'a' + 1].insert(i);
    }
  }
  for (int i = 0; i < n; i++) {
    dfs(i, true);
  }
  cout << how_many << "\n";
  return 0;
}
