#include <bits/stdc++.h>
using namespace std;
const long long int M = 1e9 + 7;
const long long int N = 1e5 + 5;
vector<long long int> v[27];
vector<long long int> vis(27);
bool cmp(string s1, string s2) {
  if (s1[0] == s2[0]) return s1.size() > s2.size();
  return s1[0] < s2[0];
}
void dfs(long long int x) {
  vis[x] = 1;
  for (auto X : v[x]) {
    if (!vis[X]) dfs(X);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  long long int n;
  cin >> n;
  long long int f[26] = {0};
  string X[n];
  for (long long int i = 0; i < n; i++) {
    cin >> X[i];
    sort(X[i].begin(), X[i].end());
    string s;
    s = X[i];
    f[s[0] - 'a'] = 1;
    v[s[0] - 'a'].push_back(s[0] - 'a');
    for (long long int j = 1; j < s.size(); j++) {
      f[s[j] - 'a'] = 1;
      v[s[0] - 'a'].push_back(s[j] - 'a');
    }
  }
  long long int ans = 0;
  sort(X, X + n, cmp);
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < X[i].size(); j++) {
      if (vis[X[i][j] - 'a'] == 0 && f[X[i][j] - 'a'] == 1) {
        long long int flag = 0;
        for (long long int k = 0; k < X[i].size(); k++) {
          if (vis[X[i][k] - 'a'] == 1) flag = 1;
        }
        if (flag == 0) {
          ans++;
        }
        dfs(X[i][0] - 'a');
        break;
      }
    }
  }
  cout << ans;
}
