#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return b;
  } else {
    return gcd(b, a % b);
  }
}
long long powc(long long a, long long b) {
  if (b < 0) {
    return -1;
  }
  long long res = 1;
  while (b > 0) {
    if (b & 1) {
      res *= a;
    }
    a *= a;
    res %= 1000000007, a %= 1000000007;
    b >>= 1;
  }
  return res;
}
vector<vector<long long> > graph(2e5);
vector<bool> visit(2e5, 0);
long long cur = 0;
void dfs(long long in) {
  visit[in] = 1;
  for (long long i = 0; i < (long long)graph[in].size(); ++i) {
    if (!visit[graph[in][i]]) {
      dfs(graph[in][i]);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  vector<string> v(n);
  for (long long i = 0; i < n; ++i) {
    cin >> v[i];
  }
  vector<vector<long long> > a(26);
  for (long long i = 0; i < n; ++i) {
    for (long long j = 0; j < (long long)v[i].size(); ++j) {
      a[v[i][j] - 'a'].push_back(i);
    }
  }
  for (long long i = 0; i < 26; ++i) {
    for (long long j = 1; j < (long long)a[i].size(); ++j) {
      graph[a[i][0]].push_back(a[i][j]);
      graph[a[i][j]].push_back(a[i][0]);
    }
  }
  for (long long i = 0; i < n; ++i) {
    if (!visit[i]) {
      cur++;
      dfs(i);
    }
  }
  cout << cur;
}
