n, m = gets.split(" ").map{|s| s.to_i} d = Array.new(n) {Array.new(n, Float::INFINITY)} m.times { a, b = gets.split(" ").map{|s| s.to_i-1} d[a][b] = d[b][a] = 1 } 0.upto(n-1) {|k| 0.upto(n-1) {|i| 0.upto(n-1) {|j| d[i][j] = [d[i][j], d[i][k] + d[k][j]].min } } } cnt = 0 0.upto(n-1) {|a| (a+1).upto(n-1) {|b| (b+1).upto(n-1) {|c| cnt += 1 if d[a][b] != 2 and d[a][c] != 2 and d[b][c] != 2 } } } puts cnt