#include <bits/stdc++.h>
using namespace std;
class Card {
 public:
  char col, val;
};
class Trial {
 public:
  int type;
  char val;
};
int main() {
  int ans = INT_MAX;
  int n;
  cin >> n;
  vector<Card> cards(n);
  set<char> colsset, valsset;
  for (int i = 0; i < n; i++) {
    scanf(" %c%c", &cards[i].col, &cards[i].val);
    colsset.insert(cards[i].col);
    valsset.insert(cards[i].val);
  }
  vector<char> cols(colsset.size()), vals(valsset.size());
  int i_ = 0;
  for (set<char>::iterator it = colsset.begin(); it != colsset.end();
       it++, i_++) {
    cols[i_] = (*it);
  }
  i_ = 0;
  for (set<char>::iterator it = valsset.begin(); it != valsset.end();
       it++, i_++) {
    vals[i_] = (*it);
  }
  int nturns = cols.size() + vals.size();
  int totry = 0;
  vector<Trial> trials(nturns);
  for (int i = 0; i < cols.size(); i++) {
    trials[i].type = 0;
    trials[i].val = *(cols.begin() + i);
  }
  for (int i = 0; i < vals.size(); i++) {
    trials[cols.size() + i].type = 1;
    trials[cols.size() + i].val = *(vals.begin() + i);
  }
  for (totry = 0; totry < (1 << nturns); totry++) {
    vector<int> know_col(n, 0);
    vector<int> know_val(n, 0);
    vector<int> colstatus(n, 0);
    vector<int> valstatus(n, 0);
    int score = 0;
    for (int bitno = 0; bitno < nturns; bitno++) {
      if (totry & (1 << bitno)) {
        score++;
        if (trials[bitno].type == 0) {
          for (int i = 0; i < n; i++)
            if (cards[i].col == trials[bitno].val) colstatus[i] = 1;
        } else {
          for (int i = 0; i < n; i++)
            if (cards[i].val == trials[bitno].val) valstatus[i] = 1;
        }
      }
      int problem = 0;
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
          Card a = cards[i];
          Card b = cards[j];
          if (a.col == b.col && a.val == b.val)
            ;
          else if (a.col != b.col && (colstatus[i] || colstatus[j]))
            ;
          else if (a.val != b.val && (valstatus[i] || valstatus[j]))
            ;
          else
            problem = 1;
        }
      }
      if (problem)
        ;
      else
        ans = min(ans, score);
    }
  }
  cout << ans;
}
