#include<bits/stdc++.h> using namespace std; struct node{ string a,b,c,d; }a[10005]; bool cmp (node t,node t1,node t2,node t3,node t4,node t5){ } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].a>>a[i].b>>a[i].c>>a[i].d; } long long cnt=0; for(int t=1;t<=n-5;t++){ for(int t1=2;t1<=n-4;t1++){ for(int t2=3;t2<=n-3;t2++){ for(int t3=4;t3<=n-2;t3++){ for(int t4=5;t4<=n-1;t4++){ for(int t5=6;t5<=n;t5++){ if(cmp(a[t],a[t1],a[t2],a[t3],a[t4],a[t5])) cnt++; } } } } } } cout<<cnt; return 0; }