#include <bits/stdc++.h>
using namespace std;
int N;
class Node {
 public:
  char parent;
  int rank;
  Node(char p, int r) {
    parent = p;
    rank = r;
  }
};
char find(vector<Node> &Nodes, char currNodeChar) {
  int idx = currNodeChar - 'a';
  if (Nodes[idx].parent != currNodeChar) {
    Nodes[idx].parent = find(Nodes, Nodes[idx].parent);
  }
  return Nodes[idx].parent;
}
void Union(vector<Node> &Nodes, char x, char y) {
  char xParent = find(Nodes, x);
  char yParent = find(Nodes, y);
  if (Nodes[xParent - 'a'].rank < Nodes[yParent - 'a'].rank) {
    Nodes[xParent - 'a'].parent = yParent;
  } else if (Nodes[xParent - 'a'].rank > Nodes[yParent - 'a'].rank) {
    Nodes[yParent - 'a'].parent = xParent;
  } else {
    Nodes[yParent - 'a'].parent = xParent;
    Nodes[xParent - 'a'].rank++;
  }
}
int main() {
  ios_base::sync_with_stdio(true);
  cin.tie(NULL);
  vector<Node> Nodes;
  for (int i = 0; i < 26; i++) {
    Nodes.emplace_back(static_cast<char>('a' + i), 0);
  }
  scanf("%d", &N);
  vector<string> v;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    v.push_back(s);
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < N; i++) {
    string s;
    s = v[i];
    sort(s.begin(), s.end());
    auto len = static_cast<int>(s.length());
    char x, y;
    x = s[0];
    for (int j = 0; j < len; j++) {
      y = s[j];
      Union(Nodes, x, y);
    }
  }
  unordered_set<char> Set;
  for (int i = 0; i < Nodes.size(); i++) {
    if (Nodes[i].rank != 0) {
      Set.insert(Nodes[i].parent);
    }
  }
  cout << Set.size() << endl;
  return 0;
}
