#include <bits/stdc++.h>
using namespace std;
string s;
int n;
int ans, mn, mark2[28], mark[28], mark3[27], mark4[29], s1 = 0, ko = 0;
int main() {
  for (int i = 0; i < 28; i++) mark[i] = 28;
  cin >> n;
  for (int l = 0; l < n; l++) {
    cin >> s;
    mn = 28;
    for (int j = 0; j < 28; j++) {
      mark2[j] = 0;
      mark3[min(j, 26)] = 0;
    }
    for (int i = 0; i < s.size(); i++) {
      mn = min(mn, mark[s[i] - 'a']);
      mark2[s[i] - 'a'] = 1;
      if (mark[s[i] - 'a'] != 28) {
        mark3[mark[s[i] - 'a']] = 1;
      }
    }
    if (mn == 28) {
      mn = ko;
      ko++;
    }
    for (int i = 0; i < 28; i++) {
      if ((mark2[i] == 1) || (mark[i] != 28 && mark3[mark[i]] == 1 && 0 == 2)) {
        mark[i] = mn;
      }
    }
  }
  for (int i = 0; i < 28; i++) {
    if (mark[i] != 28) {
      mark4[mark[i]] = 1;
    }
  }
  cout << endl;
  for (int i = 0; i < 27; i++) {
    if (mark4[i] == 1) {
      ans++;
    }
  }
  cout << ans;
}
