#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
const int N = 2e5 + 4, M = 2e9, OO = 0x3f3f3f3f;
const long long int MOD = 1000000007;
const double PI = acos(-1);
int freq[N][30];
struct DSU {
  vector<int> prt, sz;
  void init(int n) {
    prt = vector<int>(n + 1), sz = vector<int>(n + 1, 1);
    for (int i = int(1); i <= int(n + 1); i++) {
      prt[i] = i;
    }
  }
  int find(int node) {
    if (node == prt[node]) return node;
    return prt[node] = find(prt[node]);
  }
  void connect(int x, int y) {
    int node = find(x), child = find(y);
    if (sz[node] < sz[child]) swap(node, child);
    prt[child] = node;
    sz[node] += sz[child];
  }
  bool is_connected(int x, int y) { return (find(x) == find(y)); }
};
int main() {
  DSU dsu;
  int n;
  cin >> n;
  dsu.init(200005);
  for (int i = int(1); i <= int(n); i++) {
    string s;
    cin >> s;
    for (int j = 0; j < int(s.size()); ++j) {
      freq[i][s[j] - 'a']++;
    }
  }
  for (int i = 0; i < int(26); ++i) {
    vector<int> v;
    for (int j = int(1); j <= int(n); j++) {
      if (freq[j][i]) v.push_back(j);
    }
    for (int j = 0; j < int((int)v.size() - 1); ++j) {
      if (!dsu.is_connected(v[j], v[j + 1])) dsu.connect(v[j], v[j] + 1);
    }
  }
  int cnt = 0;
  for (int i = int(1); i <= int(n); i++) {
    if (dsu.prt[i] == i) cnt++;
  }
  cout << cnt;
}
