#include <bits/stdc++.h>
using namespace std;
bool visited[26];
vector<int> adj[26];
void dfs(int s) {
  visited[s] = true;
  for (int i = 0; i < adj[s].size(); i++) {
    if (visited[adj[s][i]] == false) {
      dfs(adj[s][i]);
    }
  }
}
void initialize() {
  for (int i = 0; i < 26; i++) {
    visited[i] = false;
  }
}
int main() {
  int t, n, i, count[26] = {0}, temp = 0;
  cin >> t;
  initialize();
  while (t--) {
    string s;
    cin >> s;
    n = s.length();
    for (i = 0; i < n; i++) {
      count[s[i] - 'a']++;
    }
    for (i = 0; i < n - 1; i++) {
      adj[s[i] - 'a'].push_back(s[i + 1] - 'a');
      adj[s[i + 1] - 'a'].push_back(s[i] - 'a');
    }
  }
  for (i = 0; i < 26; i++) {
    if (count[i] != 0) {
      if (visited[i] == false) {
        dfs(i);
        temp++;
      }
    }
  }
  cout << temp << "\n";
}
