#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 7;
const int inf = INT_MAX;
const long long inff = 1e18;
const long long mod = 1e9 + 7;
int p[30];
int n;
string s;
int used[40];
int Find(int x) { return p[x] == x ? x : p[x] = Find(p[x]); }
void Union(int x, int y) { p[Find(x)] = Find(y); }
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  for (int i = 1; i <= 26; i++) p[i] = i;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s;
    int N = s.length();
    for (int i = 0; i < N; i++) {
      used[s[i] - 'a' + 1]++;
    }
    for (int i = 0; i < N - 1; i++) {
      Union(s[i] - 'a' + 1, s[i + 1] - 'a' + 1);
    }
  }
  set<int> second;
  for (int i = 1; i <= 26; i++) {
    if (used[i]) {
      second.insert(Find(i));
    }
  }
  cout << ((int)(second).size()) << '\n';
}
