#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
int p[maxn];
int findx(int x) { return p[x] == x ? x : p[x] = findx(p[x]); }
vector<int> ch[26];
char s[maxn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    p[i] = i;
    scanf("%s", s);
    for (int j = 0; s[j]; ++j) {
      ch[s[j] - 'a'].push_back(i);
    }
  }
  for (int i = 0; i < 26; ++i) {
    if (ch[i].size() < 2) continue;
    for (int j = 1; j < ch[i].size(); ++j) {
      int x = findx(ch[i][j - 1]);
      int y = findx(ch[i][j]);
      if (x != y) p[x] = y;
    }
    ch[i].clear();
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    if (p[i] == i) ans++;
  }
  printf("%d\n", ans);
  return 0;
}
