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