#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 100;
vector<int> edge[N];
bool used[N];
void addedge(int v, int u) {
  edge[v].push_back(u);
  edge[u].push_back(v);
}
void dfs(int s) {
  used[s] = true;
  for (int i : edge[s]) {
    if (!used[i]) {
      dfs(i);
    }
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (auto c : s) {
      addedge(i, n + c - 'a');
    }
  }
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (!used[i]) {
      cnt++;
      dfs(i);
    }
  }
  cout << cnt;
  return 0;
}
