#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> arr(26);
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    for (char &ch : s) {
      int temp = ch - 'a';
      arr[temp].push_back(i);
    }
  }
  vector<set<int>> adj(n + 1);
  for (int i = 0; i < 26; i++) {
    for (int j = 0; j + 1 < arr[i].size(); j++) {
      adj[arr[i][j]].insert(arr[i][j + 1]);
      adj[arr[i][j + 1]].insert(arr[i][j]);
    }
  }
  int ans = 0;
  vector<bool> vis(n + 1);
  for (int i = 1; i <= n; i++) {
    if (!vis[i]) {
      ans++;
      queue<int> q;
      q.push(i);
      while (!q.empty()) {
        int temp = q.front();
        q.pop();
        for (int nb : adj[temp]) {
          if (!vis[nb]) {
            vis[nb] = true;
            q.push(nb);
          }
        }
      }
    }
  }
  cout << ans << "\n";
}
