#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = INT_MAX;
long long mod(long long a) { return (a % MOD + MOD) % MOD; }
long long mul(long long a, long long b) { return mod(mod(a) * mod(b)); }
long long add(long long a, long long b) { return mod(mod(a) + mod(b)); }
long long power(long long x, unsigned long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = res * x;
    y = y >> 1;
    x = x * x;
  }
  return res;
}
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
int binary(int arr[], int n, int key) {
  int first = 0, last = n - 1, mid = 0;
  while (first <= last) {
    mid = first + (last - first) / 2;
    if (arr[mid] < key) {
      first = mid + 1;
    } else if (arr[mid] > key) {
      last = mid - 1;
    } else {
      return mid;
    }
  }
  return -1;
}
long long min(long long a, long long b) { return a < b ? a : b; }
long long max(long long a, long long b) { return a > b ? a : b; }
class DisjSet {
  int *rank, *parent, n;

 public:
  DisjSet(int n) {
    rank = new int[n];
    parent = new int[n];
    this->n = n;
    makeSet();
  }
  void makeSet() {
    for (int i = 0; i < n; i++) {
      parent[i] = i;
    }
  }
  int find(int x) {
    if (parent[x] != x) {
      parent[x] = find(parent[x]);
    }
    return parent[x];
  }
  void Union(int x, int y) {
    int xset = find(x);
    int yset = find(y);
    if (xset == yset) return;
    if (rank[xset] < rank[yset]) {
      parent[xset] = yset;
      rank[yset] += rank[xset];
    } else {
      parent[yset] = xset;
      rank[xset] += rank[yset];
    }
  }
};
void show() {
  int n;
  cin >> n;
  DisjSet dsu(30);
  int mp[26] = {0};
  while (n--) {
    string temp;
    cin >> temp;
    for (int i = 0; i < temp.length(); ++i) {
      mp[temp[i] - 'a'] = 1;
    }
    for (int i = 0; i < temp.length() - 1; ++i) {
      dsu.Union(temp[i] - 'a', temp[i + 1] - 'a');
    }
  }
  int vis[30] = {0};
  int ct = 0;
  for (int i = 0; i < 26; ++i) {
    if (!mp[i]) continue;
    if (!vis[dsu.find(i)]) {
      vis[dsu.find(i)] = 1;
      ++ct;
    }
  }
  cout << ct << "\n";
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) show();
  return 0;
}
