from itertools import permutations def solve(): n, m = map(int, input().split()) if n < 4: return 0 node = [[0] * n for _ in range(n)] for _ in range(m): a, b = map(int, input().split()) node[a][b] = node[b][a] = 1 ans = set() for a, b, c, d in permutations(range(n), 4): if (node[a][b] == node[b][c] == node[c][d] == node[d][a] == 1) and (node[a][c] == node[b][d] == 0): ans.add(frozenset([a, b, c, d])) return len(ans) print(solve())