#include <bits/stdc++.h>
using namespace std;
vector<int> gr[27];
vector<int> gg[200011];
bool vis[200011];
void dfs(int ii) {
  vis[ii] = 1;
  for (int i = 0; i < gg[ii].size(); i++) {
    if (!vis[gg[ii][i]]) dfs(gg[ii][i]);
  }
  return;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < (n); ++i) {
    string str;
    cin >> str;
    for (int j = 0; j < (str.size()); ++j) {
      gr[str[j] - 'a'].push_back(i);
    }
  }
  for (int i = 0; i < (26); ++i) {
    if (gr[i].size()) {
      if (gr[i].size() == 1) {
        gg[gr[i][0]].push_back(gr[i][0]);
      }
      for (int j = 0; j < gr[i].size() - 1; j++) {
        gg[gr[i][j]].push_back(gr[i][j + 1]);
        gg[gr[i][j + 1]].push_back(gr[i][j]);
      }
    }
  }
  int nm = 0;
  for (int i = 0; i < (n); ++i) {
    if (gg[i].size() > 0 && !vis[i]) {
      dfs(i);
      nm++;
    }
  }
  cout << nm;
  return 0;
}
