#include <bits/stdc++.h>
using namespace std;
const long double pi = 2 * acos(0.0);
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class TT>
bool pal(T a, TT n) {
  int k = 0;
  for (int i = 0; i <= n / 2; i++) {
    if (a[i] != a[n - i - 1]) {
      k = 1;
      break;
    }
  }
  return k ? 0 : 1;
}
int p[222222], s[222222], a[300];
int find(int x) { return (p[x] == x ? x : p[x] = find(p[x])); }
bool same(int x, int y) { return (find(x) == find(y)); }
void unite(int x, int y) {
  x = find(x);
  y = find(y);
  if (s[y] > s[x]) swap(x, y);
  s[x] += s[y];
  p[y] = x;
}
int main() {
  int n;
  cin >> n;
  int ans = n;
  for (int i = 1; i <= n; i++) p[i] = i, s[i] = 1;
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    int ok = 0;
    for (int j = 0; j < s.size(); j++) {
      if (!a[s[j]]) continue;
      if (!same(a[s[j]], i)) unite(a[s[j]], i), ans--;
    }
    for (int j = 0; j < s.size(); j++) a[s[j]] = i;
  }
  cout << ans;
  getchar();
  getchar();
  return 0;
}
