#include<bits/stdc++.h>

//#define int long long
using namespace std;
typedef long long ll;

void precalc(){
	
}
void solve(){
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		string s,t,u,v;
		cin>>s>>t>>u>>v;
	}
	cout<<n*(n-1)*(n-2)*(n-3)/24;
}
signed main(){
	freopen("idioms.txt","r",stdin);
//	freopen("output.txt,"w",stdout);
//	ios::sync_with_stdio(0);
//	cin.tie(0);
//	cout.tie(0);
	precalc();
	int T=1;
//	cin>>T;
	while(T--){
			solve();
	}
	return 0;
}