n, m = map(int, input().split()) inf = 10 ** 20 d = [[inf for _ in range(n)] for _ in range(n)] for i in range(n): d[i][i] = 0 for _ in range(m): a, b = map(int, input().split()) a -= 1 b -= 1 d[a][b] = 1 d[b][a] = 1 for k in range(n): for i in range(n): for j in range(n): d[i][j] = min(d[i][j], d[i][k] + d[k][j]) ans = 0 for i in range(n): for j in range(n): if d[i][j] == 2 or i == j: continue for k in range(n): if i == k or j == k: continue if (d[i][k] != 2) and (d[j][k] != 2): ans += 1 print(ans // 6)