#include <bits/stdc++.h>
template <typename T>
T GCD(T a, T b) {
  return a ? GCD(b % a, a) : b;
}
template <typename T>
T LCM(T a, T b) {
  return (a * b) / GCD(a, b);
}
template <typename T>
std::ostream &operator<<(std::ostream &os, const std::vector<T> &v) {
  for (auto ob : v) os << ob << " ";
  return os;
}
template <typename T, typename S>
std::ostream &operator<<(std::ostream &os, const std::map<T, S> &v) {
  for (auto ob : v) os << ob.first << " : " << ob.second << std::endl;
  return os;
}
using ld = double;
using ll = long long int;
using ul = unsigned long long int;
using namespace std;
class DSecretPasswords {
  void DFS(int cur, vector<vector<int>> &v, vector<bool> &visited) {
    visited[cur] = true;
    for (int x : v[cur]) {
      if (!visited[x]) {
        DFS(x, v, visited);
      }
    }
  }

 public:
  void solve(std::istream &in, std::ostream &out) {
    int n, ans = 0;
    in >> n;
    vector<vector<int>> v(n + 27);
    vector<bool> visited(n + 27, false);
    for (int i = 0; i < n; ++i) {
      string s;
      in >> s;
      for (int j = 0; j < s.size(); ++j) {
        v[i].push_back(n + s[j] - 'a');
        v[n + s[j] - 'a'].push_back(i);
      }
    }
    for (int i = 0; i < 26; ++i) {
      if (!v[n + i].empty() && !visited[n + i]) {
        DFS(n + i, v, visited);
        ans++;
      }
    }
    out << ans << endl;
  }
};
int main() {
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(nullptr);
  DSecretPasswords solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}
