#include <bits/stdc++.h>
using namespace std;
const long long int maxn = 1e5 + 5;
const long long int inf = 1e9;
const long double PI = acos(-1);
void yes() { cout << "YES"; }
void no() { cout << "NO"; }
long long int pmod(long long int a, long long int mod = 1000000007) {
  return ((a) % mod + mod) % mod;
}
long long int cel(long long int x1, long long int y1) {
  if ((x1) <= 0) {
    return (x1) / (y1);
  }
  return (((x1) / (y1)) + (((x1) % (y1)) != 0));
}
long long int gcd(long long int a, long long int b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return (a / gcd(a, b)) * b;
}
long long bp(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
long long bpm(long long a, long long b, long long m = 1000000007) {
  if (a >= m) a %= m;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res *= a;
    if (res >= m) res %= m;
    a *= a;
    if (a >= m) a %= m;
    b >>= 1;
  }
  if (res >= m) res %= m;
  return res;
}
string vow = "aeiou";
const int dx4[] = {-1, 0, 1, 0};
const int dy4[] = {0, 1, 0, -1};
const int dx8[] = {-1, 0, 1, 0, -1, -1, 1, 1};
const int dy8[] = {0, 1, 0, -1, -1, 1, -1, 1};
const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};
vector<int> pa, ra;
int find(int v) {
  if (pa[v] == v) return v;
  return pa[v] = find(pa[v]);
}
void merge(int u, int v) {
  int pu = find(u);
  int pv = find(v);
  if (pu == pv) return;
  if (ra[pu] <= ra[pv]) {
    if (ra[pu] == ra[pv]) ra[pv]++;
    pa[pu] = pv;
  } else
    pa[pv] = pu;
}
void solve() {
  int n;
  cin >> n;
  string s[n];
  for (int i = 0; i < n; i++) cin >> s[i];
  ;
  pa = vector<int>(n);
  for (int i = 0; i < n; i++) pa[i] = i;
  ra = vector<int>(n, 0);
  vector<vector<int>> st(26);
  for (int i = 0; i < n; i++) {
    for (auto val : s[i]) {
      if (!((st[val - 'a']).size()) || st[val - 'a'].back() != i)
        st[val - 'a'].push_back(i);
    }
  }
  for (int i = 0; i < 26; i++) {
    for (int j = 1; j < ((st[i]).size()); j++) merge(st[i][j - 1], st[i][j]);
  }
  int ans = 0;
  for (int i = 0; i < n; i++)
    if (pa[i] == i) ans++;
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  ;
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
