N,M = map(int,input().split()) INFTY = 10**5 dist = [[INFTY for _ in range(N+1)]for _ in range(N+1)] G = {i:[] for i in range(1,N+1)} for _ in range(M): a,b = map(int,input().split()) G[a].append(b) G[b].append(a) dist[a][b] = 1 dist[b][a] = 1 for i in range(1,N+1): dist[i][i] = 0 for k in range(1,N+1): for i in range(1,N+1): for j in range(1,N+1): dist[i][j] = min(dist[i][j],dist[i][k]+dist[k][j]) ans = 0 for i in range(1,N-1): for j in range(i+1,N): for k in range(j+1,N+1): if dist[i][j]==2 or dist[j][k]==2 or dist[k][i]==2:continue ans += 1 print(ans)