#include<bits/stdc++.h>
using namespace std;
#define int long long

inline int read(){
	int x = 0,f = 1;char c = getchar();
	while(!isdigit(c)){if(c == '-')f = -1;c = getchar();}
	while(isdigit(c)){x = x*10 + c-'0';c = getchar();}
	return x*f;
}

map<string,int>m;

signed main(){
	int n = read();
	for(int i = 1;i <= n;i++){
		string s1,s2,s3,s4;
		cin >> s1 >> s2 >> s3 >> s4;
		m[s1]++;
		m[s4]++;
	}
	int s = 0;
	for(auto a:m)s += a.second/3;
	cout << s/4;
}