N, M = gets.split.map(&:to_i) a, b = (1..M).map {gets.split.map(&:to_i)}.transpose g = Array.new(N) {|i| Array.new(N) {|j| a.zip(b).any? {|x, y| [x, y] == [i, j].sort}}} ans = if N <= 3 0 else (0...N).to_a.combination(4).count {|arr| arr.permutation.any? {|x, y, z, w| g[x][y] and g[y][z] and g[z][w] and g[w][x] and not g[x][z] and not g[y][w]}} end puts ans