#include <bits/stdc++.h>
using namespace std;
bool isprime(long long int n) {
  for (long long i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
const long long int cnst = 1e9 + 7, di = 998244353;
bool IsQuery = false, found = false;
long long int q = 1, cnt, n, k;
set<long long int> factors(long long int n);
map<int, vector<long long int> > connected;
map<int, bool> occured, f;
vector<long long int> len;
int dx[] = {1, -1, 0, 0};
int dy[] = {0, 0, 1, -1};
string s[200000], t;
void dfs(int k) {
  occured[k] = true;
  for (auto i : s[k]) {
    if (f[i]) continue;
    f[i] = true;
    for (auto j : connected[i]) {
      if (!occured[j]) dfs(j);
    }
  }
  return;
}
void solve() {
  long long int d = 0, x = 0, y = 0, z, minm = 1, maxm = 1, sum = 0, l = 0,
                flag = 0, val, ans = 0;
  map<long long int, long long int> f;
  set<long long int> set;
  vector<long long int> a, p;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    for (int j = 0; j < s[i].size(); j++) connected[s[i][j]].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    if (!occured[i]) ans++, dfs(i);
  }
  cout << ans;
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  if (IsQuery) cin >> q;
  for (int i = 0; i < q; i++) solve();
  return 0;
}
set<long long int> factors(long long int n) {
  set<long long int> f;
  for (long long int x = 2; x * x <= n; x++) {
    while (n % x == 0) {
      f.insert(x);
      n /= x;
    }
  }
  if (n > 1) f.insert(n);
  return f;
}
