#include <bits/stdc++.h>
using namespace std;
long long int MOD = 1e9 + 7;
long long int prime[10000000];
long long int fac[200100], ifac[200100];
long long int inv[200100];
vector<long long int> primes;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool IsPrime(long long int x) {
  if (x == 1) return false;
  for (long long int i = 2; i * i <= x; i++) {
    if (x % i == 0) return false;
  }
  return true;
}
void seive(long long int n) {
  prime[0] = prime[1] = 1;
  for (long long int i = 2; i * i <= n; i++)
    if (!prime[i]) {
      primes.push_back(i);
      for (long long int j = i * i; j <= 1e6; j += i) prime[j] = 1;
    }
}
bool sortMa7boub(const pair<long double, int>& a,
                 const pair<long double, int>& b) {
  if (a.first == b.first) return (a.second < b.second);
  return (a.first > b.first);
}
bool IsVowel(char c) {
  return (c == 'a' || c == 'e' || c == 'i' || c == 'u' || c == 'o' ||
          c == 'y' || c == 'A' || c == 'E' || c == 'I' || c == 'U' ||
          c == 'O' || c == 'Y');
}
bool IsEqual(string s1, string s2) {
  if (s1.length() != s2.length()) return 0;
  for (int i = 0; i < s1.length(); i++)
    if (s1[i] != s2[i]) return 0;
  return 1;
}
long long int powMod(long long int base, long long int pw) {
  long long int ret = 1;
  while (pw) {
    if (pw & 1) ret = (ret * base) % MOD;
    base = (base * base) % MOD;
    pw >>= 1;
  }
  return ret;
}
void makeFact() {
  fac[0] = ifac[0] = 1;
  for (long long int i = 1; i < 200100; i++) {
    fac[i] = (fac[i - 1] * i) % MOD;
    ifac[i] = powMod(fac[i], MOD - 2);
  }
}
inline void Init() {
  inv[1] = 1;
  for (int i = 2; i < 200100; ++i)
    inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;
}
long long int C(long long int a, long long int b) {
  if (a < b) return 0;
  return (((fac[a] * ifac[b]) % MOD) * ifac[a - b]) % MOD;
}
long long int P(long long int a, long long int b) {
  if (a < b) return 0;
  return (fac[a] * ifac[a - b]) % MOD;
}
long long int sum(long long int k) { return (k % MOD) * ((k + 1) % MOD) / 2; }
long long int pascalDivisibility(long long int n, long long int p) {
  long long int ans = 1;
  long long int i = 0;
  while (n) {
    ans = (sum(n % p) % MOD) * (powMod(sum(p), i) % MOD) +
          ((n % p + 1) % MOD) * (ans % MOD);
    ans %= MOD;
    n /= p;
    i++;
  }
  return ans % MOD;
}
bool PointInRectangle(long double x1, long double y1, long double x2,
                      long double y2, long double x, long double y) {
  return (x >= x1 && x <= x2 && y >= y1 && y <= y2);
}
bool InRange(long long int a, long long int b, long long int c) {
  return a >= b && a <= c;
}
string AL = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
long long int prr[30];
long long int freq[30];
int par[30], ch[30];
void init() {
  for (int i = 0; i < 30; i++) par[i] = i, ch[i] = 1;
}
int find(int u) { return u == par[u] ? u : u = find(par[u]); }
bool Union(int u, int v) {
  int Pu = find(u), Pv = find(v);
  if (Pu != Pv) {
    if (ch[Pu] >= ch[Pv])
      ch[Pu] += ch[Pv], par[Pv] = Pu;
    else
      ch[Pv] += ch[Pu], par[Pu] = Pv;
    return 1;
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  long long int ans(0);
  map<char, int> mp;
  init();
  for (int k = 0; k < n; k++) {
    string s;
    cin >> s;
    bool ok = 1;
    freq[s[0] - 'a'] = 1;
    int prev = s[0] - 'a';
    for (int i = 0; i < s.length(); i++) {
      int cur = s[i] - 'a';
      Union(cur, prev);
      prev = (s[i] - 'a');
      freq[s[i] - 'a'] = 1;
    }
  }
  set<int> ss;
  for (int i = 0; i < 26; i++) {
    if (freq[i]) {
      ss.insert(find(i));
    }
  }
  cout << ss.size() << endl;
  return 0;
}
