from collections import defaultdict from itertools import combinations def solve(): n, m = map(int, input().split()) if n < 4: return 0 node = defaultdict(set) for _ in range(m): a, b = map(int, input().split()) node[a].add(b) node[b].add(a) ans = 0 for i in range(n - 1): for j in range(i + 1, n): if j in node[i]: continue sn = node[i] & node[j] - {i, j} if len(sn) < 2: continue for a, b in combinations(tuple(sn), 2): if a not in node[b]: ans += 1 return ans // 4 print(solve())