#include <bits/stdc++.h>
using namespace std;
bool vis[27] = {false};
vector<int> v[27];
void dfs(int u) {
  if (vis[u] == true) return;
  vis[u] = true;
  for (int l = 0; l < v[u].size(); l++) {
    if (vis[v[u][l]] == false) {
      dfs(v[u][l]);
    }
  }
}
int main() {
  int a, b, c, d, i, j, k, l, n, m;
  cin >> n;
  string s;
  int mp[27] = {0};
  for (i = 0; i < n; i++) {
    cin >> s;
    int p = s[0] - 'a';
    mp[p] = 1;
    for (l = 1; l < s.size(); l++) {
      int p1 = s[l] - 'a';
      mp[p1] = 1;
      v[p].push_back(p1);
      v[p1].push_back(p);
    }
  }
  int ans = 0;
  for (l = 0; l < 26; l++) {
    if (mp[l] == 1 && (vis[l] == false)) {
      dfs(l);
      ans++;
    }
  }
  cout << ans << endl;
}
