import itertools n, m = map(int, input().split()) adj = [[False] * n for _ in range(n)] for _ in range(m): a, b = map(int, input().split()) adj[a][b] = True adj[b][a] = True count = 0 # Iterate through all possible quartets of 4 distinct nodes for quartet in itertools.combinations(range(n), 4): # Check if there are exactly 4 edges within the quartet edge_count = 0 for u, v in itertools.combinations(quartet, 2): if adj[u][v]: edge_count += 1 if edge_count != 4: continue # Check each node in the quartet has exactly two edges within the quartet valid = True for node in quartet: connections = 0 for other in quartet: if other != node and adj[node][other]: connections += 1 if connections != 2: valid = False break if valid: count += 1 print(count)