import java.util.*; import java.io.*; public class Main { static HashSet[] graph; static int n; public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] first = br.readLine().split(" ", 2); int n = Integer.parseInt(first[0]); int m = Integer.parseInt(first[1]); graph = new HashSet[n]; for (int i = 0; i < n; i++) { graph[i] = new HashSet(); } for (int i = 0; i < m; i++) { String[] line = br.readLine().split(" ", 2); int a = Integer.parseInt(line[0]); int b = Integer.parseInt(line[1]); graph[a].add(b); graph[b].add(a); } int count = 0; for (int i = 0; i < n; i++) { if (graph[i].size() < 2) { continue; } for (int x : graph[i]) { for (int y : graph[i]) { if (x >= y) { continue; } if (graph[x].contains(y)) { continue; } count += getCount(x, y, i); } } } System.out.println(count / 4); } static int getCount(int a, int b, int except) { int count = 0; for (int i = 0; i < graph.length; i++) { if (i == except) { continue; } if (graph[i].contains(a) && graph[i].contains(b) && !graph[i].contains(except)) { count++; } } return count; } }