#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
const int maxn = 3e5 + 5;
int T, n, ans, vis[200];
char s[maxn][55];
vector<int> g[maxn];
void dfs(int u) {
  vis[u] = 1;
  for (auto v : g[u]) {
    if (!vis[v]) dfs(v);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s[i]);
    int len = strlen(s[i]);
    for (int j = 0; j < len; j++)
      for (int k = 0; k < len; k++) g[s[i][j]].push_back(s[i][k]);
  }
  for (int i = 1; i <= n; i++) {
    int len = strlen(s[i]), f = 0;
    for (int j = 0; j < len; j++)
      if (!vis[s[i][j]]) f = 1, dfs(s[i][j]);
    if (f) ans++;
  }
  printf("%d\n", ans);
}
