#include <bits/stdc++.h>
using namespace std;
inline long long isqrt(long long k) {
  long long r = sqrt(k) + 1;
  while (r * r > k) r--;
  return r;
}
inline long long icbrt(long long k) {
  long long r = cbrt(k) + 1;
  while (r * r * r > k) r--;
  return r;
}
inline long long mnz(long long& a, long long b) { return a = (a > b ? b : a); }
inline long long mxz(long long& a, long long b) { return a = (a < b ? b : a); }
inline string toString(long long n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
double const eps = 1e-6;
long long const Base = 1e9 + 7, oo = 1e17, MAXN = 1e6;
string A[MAXN + 5];
vector<long long> dske[MAXN + 5];
bitset<MAXN + 5> bi, b2;
long long Solves() {
  long long n, m, k, cnt = 0, ans = 0, x, y, q, c, sum = 0, v, t;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> A[i];
    for (long long j = 0; j + 1 <= A[i].length(); j++)
      dske[A[i][j]].push_back(i);
  }
  for (long long k = 1; k <= n; k++) {
    if (bi[k]) continue;
    queue<long long> qu;
    qu.push(k);
    bi[k] = 1;
    ans++;
    while ((long long)qu.size()) {
      x = qu.front();
      qu.pop();
      for (long long j = 0; j + 1 <= A[x].length(); j++) {
        t = A[x][j];
        if (b2[t]) continue;
        b2[t] = 1;
        for (long long i = 0; i < dske[t].size(); i++)
          if (!bi[dske[t][i]]) {
            qu.push(dske[t][i]);
            bi[dske[t][i]] = 1;
          }
      }
    }
  }
  cout << ans << endl;
  return 0;
}
int main() {
  if (fopen("locin.txt", "r")) freopen("locin.txt", "r", stdin);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long test = 1;
  for (long long T = 1; T <= test; T++) {
    Solves();
  }
}
