#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
long long n;
string s[N];
vector<long long> pos[30], adj[N];
bool vis[N];
void dfs(long long v) {
  vis[v] = true;
  for (auto u : adj[v]) {
    if (!vis[u]) dfs(u);
  }
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long T = 1;
  while (T--) {
    cin >> n;
    for (long long i = 1; i <= n; i++) {
      cin >> s[i];
    }
    for (long long i = 1; i <= n; i++) {
      for (auto c : s[i]) pos[c - 'a'].push_back(i);
    }
    for (long long i = 0; i < 26; i++) {
      for (long long j = 0; j + 1 < pos[i].size(); j++) {
        long long u = pos[i][j];
        long long v = pos[i][j + 1];
        adj[u].push_back(v);
        adj[v].push_back(u);
      }
    }
    long long cc = 0;
    for (long long i = 1; i <= n; i++) {
      if (!vis[i]) {
        dfs(i);
        cc++;
      }
    }
    cout << cc << '\n';
  }
  return 0;
}
