#include <bits/stdc++.h>
using namespace std;
vector<int> adj[1000000];
int visited[1000000];
void dfs(int n) {
  if (visited[n]) return;
  visited[n] = 1;
  for (int i = 0; i < adj[n].size(); i++) dfs(adj[n][i]);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  string str[n];
  for (int i = 0; i < n; i++) {
    cin >> str[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < str[i].length(); j++) {
      adj[i].push_back(n + str[i][j] - 'a');
      adj[n + str[i][j] - 'a'].push_back(i);
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (visited[i] == 0 && adj[i].size()) {
      cnt++;
      dfs(i);
    }
  }
  cout << cnt << endl;
  return 0;
}
