import sys readline = sys.stdin.readline N, M = map(int, readline().split()) S = set() inf = 10 ** 18 G = [[inf] * N for i in range(N)] for i in range(M): a, b = map(int, readline().split()) a, b = a - 1, b - 1 G[a][b] = 1 G[b][a] = 1 for i in range(N): for j in range(N): for k in range(N): G[i][j] = min(G[i][j], G[i][k] + G[k][j]) ans = N * (N - 1) * (N - 2)//6 for i in range(N): for j in range(i + 1, N): for k in range(j + 1, N): if G[i][j] == 2 or G[j][k] == 2 or G[k][i] == 2: ans -= 1 print(ans)