#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
char s[105][3];
bool know[255];
int match[255];
int main() {
  vector<int> v;
  int ans = 2e9, n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%s", s[i]);
    for (int j = 0; j < 2; j++) {
      v.push_back(s[i][j]);
    }
  }
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  int m = v.size();
  for (int i = 0; i < (1 << m); i++) {
    memset(know, 0, sizeof(know));
    memset(match, 0, sizeof(match));
    int cnt = 0;
    for (int j = 0; j < m; j++) {
      if ((i >> j) & 1) {
        know[v[j]] = 1;
        cnt++;
      }
    }
    int notok = 0;
    bool ok = 1;
    for (int k = 0; k < n; k++) {
      if (know[s[k][0]] && know[s[k][1]])
        continue;
      else if (know[s[k][0]]) {
        if (match[s[k][0]]) {
          if (match[s[k][0]] != s[k][1]) {
            ok = 0;
            break;
          }
        } else
          match[s[k][0]] = s[k][1];
      } else if (know[s[k][1]]) {
        if (match[s[k][1]]) {
          if (match[s[k][1]] != s[k][0]) {
            ok = 0;
            break;
          }
        } else
          match[s[k][1]] = s[k][0];
      } else {
        if (match[s[k][0]]) {
          if (match[s[k][0]] != s[k][1]) {
            ok = 0;
            break;
          }
        } else
          match[s[k][0]] = s[k][1], notok++;
        if (match[s[k][1]]) {
          if (match[s[k][1]] != s[k][0]) {
            ok = 0;
            break;
          }
        } else
          match[s[k][1]] = s[k][0];
        if (notok == 2) {
          ok = 0;
          break;
        }
      }
    }
    if (ok) ans = min(ans, cnt);
  }
  printf("%d\n", ans);
}
