#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lb = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<lb, lb>;
template <class T>
bool umin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool umax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());
long long random(long long l, long long r) {
  return (rando() % (r - l + 1) + l);
}
long long udiv(long long a, long long b) {
  return a / b + ((a ^ b) > 0 && a % b);
}
long long getbit(long long a, long long b) { return a & (1 << b); }
long long onbit(long long a, long long b) { return a | (1 << b); }
long long offbit(long long a, long long b) {
  return (!getbit(a, b)) ? a : a ^ (1 << b);
}
const int d4i[4] = {-1, 0, 1, 0}, d4j[4] = {0, 1, 0, -1};
const int d8i[8] = {-1, -1, 0, 1, 1, 1, 0, -1},
          d8j[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const ll mxN = 2e5 + 5;
const ll MOD = 1e9 + 7;
const ll oo = 1e18;
const ll base = 311;
int n, answer;
string s[mxN];
int dsu[mxN];
bool letter[27];
vector<int> adj[mxN];
int getRoot(int node) {
  if (dsu[node] < 0) return node;
  return dsu[node] = getRoot(dsu[node]);
}
void merge(int x, int y) {
  x = getRoot(x);
  y = getRoot(y);
  if (x == y) return;
  if (dsu[x] > dsu[y]) swap(x, y);
  dsu[x] += dsu[y];
  dsu[y] = x;
}
void solve() {
  cin >> n;
  for (int i = (1); (1) > 0 ? i <= (n) : i >= (n); i += (1)) {
    dsu[i] = -1;
    cin >> s[i];
    for (int j = (1);
         (1) > 0 ? j <= ((int)(s[i]).size()) : j >= ((int)(s[i]).size());
         j += (1))
      if (!letter[s[i][j - 1] - 'a' + 1]) {
        adj[s[i][j - 1] - 'a' + 1].push_back(i);
      }
    memset(letter, 0, sizeof(letter));
  }
  for (int i = (1); (1) > 0 ? i <= (26) : i >= (26); i += (1)) {
    for (int j = (1);
         (1) > 0 ? j <= ((int)(adj[i]).size()) : j >= ((int)(adj[i]).size());
         j += (1))
      merge(adj[i][0], adj[i][j - 1]);
  }
  for (int i = (1); (1) > 0 ? i <= (n) : i >= (n); i += (1))
    if (dsu[i] < 0) answer++;
  cout << answer;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  for (int i = (1); (1) > 0 ? i <= (t) : i >= (t); i += (1)) {
    solve();
  }
}
