#include using namespace std; int main(){ int N,index,sum=0,count[10]={0},ans=0; scanf("%d",&N); for(int i=0;i<3*N;++i){ scanf("%d",&index); ans+=count[index-1]; sum+=1-2*count[index-1]; count[index-1]=1-count[index-1]; } printf("%d\n",ans+sum/4); }