#include<bits/stdc++.h>
using namespace std;
const int N = 305;
#define F(i,a,b) for(int i=a;i<=b;i++)
int n,ans;
char a,b;
string x = "DCHS",y = "A23456789TJQK";
bool vis[N][N];
int main()
{
cin>>n;
F(i,1,n)
{
cin>>a>>b;
vis[a][b] = 1;
}
for(int i = 0;i<x.size();i++)
for(int j = 0;j<y.size();j++)
if(!vis[x[i]][y[j]]) ans++;
cout << ans << '\n';
return 0;
}