#include<iostream> #include<cstdio> #include<algorithm> #define maxn 100010 #define maxm 200010 #define ll long long usingnamespacestd;
int n, m, x[maxm], y[maxm], du[maxn];
structEdge { int to, next; } e[maxm]; int c1, head[maxn]; inlinevoidadd_edge(int u, int v){ e[c1].to = v; e[c1].next = head[u]; head[u] = c1++; }
int ans, vis[maxn]; intmain(){ fill(head, head + maxn, -1); ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
cin >> n >> m; for (int i = 1; i <= m; ++i) cin >> x[i] >> y[i], ++du[x[i]], ++du[y[i]]; for (int i = 1; i <= m; ++i) { int u = x[i], v = y[i]; if (du[u] > du[v] || du[u] == du[v] && u > v) swap(u, v); add_edge(u, v); } for (int u = 1; u <= n; ++u) { for (int i = head[u]; ~i; i = e[i].next) vis[e[i].to] = u; for (int i = head[u]; ~i; i = e[i].next) { int v = e[i].to; for (int j = head[v]; ~j; j = e[j].next) if (vis[e[j].to] == u) ++ans; } } cout << ans << "\n"; return0; }