#include <bits/stdc++.h>
using namespace std;
vector<string> v1;
vector<vector<int> > v;
bool vis[200005];
void dfs(int i) {
  vis[i] = true;
  for (int j = 0; j < v[i].size(); j++) {
    if (!vis[v[i][j]]) {
      dfs(v[i][j]);
    }
  }
}
int main() {
  int n;
  cin >> n;
  memset(vis, 0, sizeof(vis));
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    v1.push_back(s);
  }
  v.resize(n + 1);
  for (int i = 0; i < 26; i++) {
    int ch = -1;
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < v1[j].size(); k++) {
        if (v1[j][k] - 'a' == i) {
          if (ch != -1) {
            v[ch].push_back(j);
            v[j].push_back(ch);
            ch = j;
          } else {
            ch = j;
          }
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (!vis[i]) {
      ans++;
      dfs(i);
    }
  }
  cout << ans;
}
