#include <bits/stdc++.h>
using namespace std;
const int maxn = 30;
vector<int> G[maxn];
int f[200005], Rank[200005];
char a[210050][55];
bool vis[maxn];
set<int> s;
int Find(int x) {
  if (f[x] == x)
    return x;
  else
    return f[x] = Find(f[x]);
}
void join(int x, int y) {
  x = Find(x);
  y = Find(y);
  f[x] = y;
}
int main() {
  int t, n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    f[i] = i;
    scanf("%s", a[i]);
    memset(vis, 0, sizeof vis);
    int len = strlen(a[i]);
    for (int j = 0; j < len; j++) {
      int vv = a[i][j] - 'a';
      if (!vis[vv]) G[vv].push_back(i), vis[vv] = 1;
    }
  }
  memset(vis, 0, sizeof vis);
  for (int i = 1; i <= n; i++) {
    int len = strlen(a[i]);
    for (int j = 0; j < len; j++) {
      int vv = a[i][j] - 'a';
      if (!vis[vv]) {
        int len1 = G[vv].size();
        for (int k = 0; k < len1; k++) {
          join(G[vv][k], i);
        }
        vis[vv] = 1;
      }
    }
  }
  for (int i = 1; i <= n; i++) s.insert(Find(i));
  cout << s.size() << endl;
}
