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 = set() for k, v in node.items(): for a, b in combinations(tuple(v), 2): if a in node[b]: continue for c in node[a] & node[b] - {k}: if k not in node[c]: ans.add(frozenset([a, b, c, k])) return len(ans) print(solve())