N,M=map(int,input().split()) Z=[[]for i in range(N)] for _ in range(M):a,b=map(int,input().split());Z[a].append(b);Z[b].append(a) A=0 for h in range(N): v=Z[h] for i in range(len(v)): for j in range(i+1,len(v)): p,q=v[i],v[j];P,Q=Z[p],Z[q] for c in set(P)&set(Q):A+=(q not in P and h!=c and h not in Z[c]) print(A//4)