#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long inf = 1LL << 62;
const long long mx = 100005;
long long dx[10] = {1, 0, -1, 0};
long long dy[10] = {0, -1, 0, 1};
long long par[200005];
void make_set(long long n) {
  for (long long i = 0; i <= n; i++) par[i] = i;
}
long long find_par(long long n) {
  if (n == par[n]) return n;
  par[n] = find_par(par[n]);
  return par[n];
}
void make_friend(long long a, long long b) {
  long long u = find_par(a);
  long long v = find_par(b);
  if (u != v) {
    par[u] = v;
  }
}
bool grid[200005][27];
int main() {
  long long tst, a, b, c, k, n, m, res = 0, ans = 0, t = 0;
  scanf("%lld", &n);
  memset(grid, 0, sizeof(grid));
  make_set(n);
  for (long long i = 1; i <= n; i++) {
    string str;
    cin >> str;
    for (long long j = 0; j < (long long)(str).size(); j++) {
      a = str[j] - 'a';
      grid[i][a] = 1;
    }
  }
  if (n == 1) {
    cout << 1 << "\n";
    return 0;
  }
  for (long long j = 0; j <= 25; j++) {
    long long ck = 0;
    for (long long i = 1; i <= n; i++) {
      if (ck == 0 and grid[i][j]) {
        ck = i;
      }
      if (grid[i][j]) {
        make_friend(ck, i);
      }
    }
  }
  set<long long> s;
  for (long long i = 1; i <= n; i++) {
    s.insert(find_par(i));
  }
  cout << (long long)(s).size() << "\n";
  return 0;
}
