#include <bits/stdc++.h>
using namespace std;
void sievee(long long int n) {
  bool sieve[1000000007 + 10];
  memset(sieve, true, 1000000017);
  long long int co = 0;
  sieve[0] = false;
  sieve[1] = false;
  vector<long long int> v;
  long long int i, j;
  for (i = 2; i * i <= 1000000007; i++) {
    if (sieve[i] == true) {
      for (j = i * i; j <= 1000000007; j += i) {
        sieve[j] = false;
      }
      v.push_back(i);
      co++;
      if (co == n) break;
    }
  }
}
bool isPrime(long long int n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (long long int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
long long int power(long long int base, long long int exp) {
  long long int res = 1;
  while (exp > 0) {
    if (exp % 2 == 1) res = (res * base) % 1000000007;
    base = (base * base) % 1000000007;
    exp /= 2;
  }
  return res % 1000000007;
}
long long int dp[200005][26];
long long int n, m;
vector<long long int> adj[200005];
bool vis[200005];
void ini() {
  for (long long int i = 0; i < 200005; i++) {
    vis[i] = false;
    for (long long int j = 0; j < 26; j++) dp[i][j] = 0;
  }
}
void dfs(long long int s) {
  vis[s] = true;
  for (long long int i = 0; i < adj[s].size(); i++) {
    if (vis[adj[s][i]] == false) {
      dfs(adj[s][i]);
    }
  }
}
void solve() {
  string s;
  cin >> n;
  ini();
  for (long long int h = 0; h < n; h++) {
    cin >> s;
    for (long long int i = 0; i < s.size(); i++) {
      dp[h][s[i] - 'a'] = 1;
    }
  }
  vector<long long int> v;
  for (long long int j = 0; j < 26; j++) {
    v.clear();
    for (long long int i = 0; i < n; i++) {
      if (dp[i][j] == 1) v.push_back(i);
    }
    if (v.size() >= 2) {
      long long int te = *v.begin();
      for (long long int k = 1; k < v.size(); k++) {
        adj[te].push_back(v[k]);
        adj[v[k]].push_back(te);
        te = v[k];
      }
    }
  }
  long long int ans = 0;
  for (long long int i = 0; i < n; i++) {
    if (vis[i] == false) {
      dfs(i);
      ans++;
    }
  }
  cout << ans;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
