#include <bits/stdc++.h>
using namespace std;
#define FASTOI ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n,ans = 0;
vector<char> cnt[16*2];
int ctn(char k)
{
if(k == 'T') return 10;
else if(k == 'J') return 11;
else if(k == 'Q') return 12;
else if(k == 'K') return 13;
else if(k == 'A') return 14;
else return (int(k)-'0');
}
int ctn2(char k)
{
if(k == 'S') return 0;
else if(k == 'H') return 1;
else if(k == 'C') return 2;
else if(k == 'D') return 3;
else return 404;
}
int main()
{
FASTOI;
cin >> n;
for(int i = 0;i < n;i++)
{
char t[2];
cin >> t;
cnt[ctn(t[1])].push_back(t[0]);
}
for(int i = 0;i < 16;i++)
{
int t[4] = {0,0,0,0};
for(auto j : cnt[i]) t[ctn2(j)]++;
sort(t,t+4);
int sum = 0;
for(int j = 0;j < 4;j+=2)
{
int l = t[j]+t[j+1];
l/=3;
sum += l;
}
ans += sum;
}
cout << ans;
return 0;
}