#include <bits/stdc++.h>
using namespace std;
const int n = 28;
int par[n], t, ans = 0;
char str[55];
bool vis[n];
int find(int x) {
  if (x == par[x]) return x;
  return find(par[x]);
}
int main() {
  scanf("%d", &t);
  for (int i = 0; i < n; i++) par[i] = i;
  for (int i = 1; i <= t; i++) {
    scanf("%s", str);
    int len_s = strlen(str);
    vis[str[0] - 'a'] = true;
    for (int j = 1; j < len_s; j++) {
      vis[str[j] - 'a'] = true;
      int a = find(str[j] - 'a');
      int b = find(str[j - 1] - 'a');
      if (a != b) {
        par[a] = b;
      }
    }
  }
  for (int i = 0; i < 26; i++) {
    if (vis[i] && par[i] == i) ans++;
  }
  cout << ans << endl;
  return 0;
}
