#include <bits/stdc++.h>
using namespace std;
const long double Pi = 3.141592653;
const long long mod = 1e9 + 7;
long long INF = 1000000000000000000;
vector<int> cnt[200027];
string s[200001];
int vis2[200027] = {0};
bool cmp(pair<int, int> a, pair<int, int> b) {
  return (a.first < b.first) || (a.first == b.first && a.second > b.second);
}
void dfs(int x) {
  for (int j = 0; j < cnt[x].size(); j++) {
    if (!vis2[cnt[x][j]]) vis2[cnt[x][j]] = 1, dfs(cnt[x][j]);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      cin >> s[i];
      for (int j = 0; j < s[i].length(); j++) {
        cnt[s[i][j] - 'a' + n].push_back(i);
        cnt[i].push_back(s[i][j] - 'a' + n);
      }
    }
    for (int i = n; i < n + 26; i++) {
      if (cnt[i].size() && !vis2[i]) {
        dfs(i);
        ++ans;
      }
    }
    cout << ans;
  }
}
