from collections import deque n, m = map(int, input().split()) g = [[] for _ in range(n)] for _ in range(m): u, v = map(int, input().split()) g[u].append(v) g[v].append(u) count = 0 for i in range(n): d_1 = g[i] d_2 = deque([]) d_3 = deque([]) for j in d_1: for k in g[j]: if k != i: d_2.append([k, j]) for j in range(len(d_2)): now_2 = d_2.pop() if i not in g[now_2[0]]: for k in g[now_2[0]]: if k != now_2[1]: d_3.append([k, now_2[0], now_2[1]]) for j in range(len(d_3)): now_3 = d_3.pop() if i in g[now_3[0]] and now_3[2] not in g[now_3[0]]: count += 1 print(count // 8)