#include <bits/stdc++.h>
using namespace std;
map<char, int> m;
int f[50];
int find(int x) { return f[x] == x ? x : f[x] = find(f[x]); }
void unionn(int x, int y) { f[find(y)] = find(x); }
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < 26; i++) f[i] = i;
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    m[s[0] - 'a'] = 1;
    for (int j = 1; j < s.size(); j++)
      m[s[j] - 'a'] = 1, unionn(s[j] - 'a', s[j - 1] - 'a');
  }
  int ans = 0;
  for (int i = 0; i < 26; i++)
    if (m[i] && f[i] == i) ans++;
  cout << ans;
  return 0;
}
