#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
string s[MAXN];
vector<int> v[30];
int fa[MAXN];
void init(int n) {
  for (int i = 1; i <= n; ++i) {
    fa[i] = i;
  }
}
int findd(int x) { return x == fa[x] ? x : fa[x] = findd(fa[x]); }
int main() {
  int n;
  cin >> n;
  init(n);
  for (int i = 1; i <= n; ++i) {
    cin >> s[i];
  }
  for (int i = 1; i <= n; ++i) {
    int len = s[i].size();
    for (int j = 0; j < len; ++j) {
      v[s[i][j] - 'a'].push_back(i);
    }
  }
  for (int i = 0; i < 26; ++i) {
    int len = v[i].size();
    for (int j = 0; j < len; ++j) {
      int fx = findd(v[i][0]);
      int fy = findd(v[i][j]);
      if (fx != fy) {
        fa[fx] = fy;
      }
    }
  }
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    if (fa[i] == i) cnt++;
  }
  cout << cnt << endl;
  return 0;
}
