inlineintread(){ int x = 0, f = 0; char c = 0; while (!isdigit(c)) f |= c == '-', c = getchar(); while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar(); return f ? -x : x; }
#define N 100010 #define M 200010 #define pb push_back
int n, m, x[M], y[M], deg[N], vis[N]; vector<int> e[N];
intmain(){ n = read(), m = read(); for (int i = 1; i <= m; i ++) { x[i] = read(), y[i] = read(); deg[x[i]] ++, deg[y[i]] ++; }
for (int i = 1; i <= m; i ++) { if (deg[x[i]] < deg[y[i]] || deg[x[i]] == deg[y[i]] && x[i] < y[i]) e[x[i]].pb(y[i]); else e[y[i]].pb(x[i]); }
int res = 0; for (int i = 1; i <= n; i ++) { for (auto j : e[i]) vis[j] = 1; for (auto j : e[i]) for (auto k : e[j]) if (vis[k]) res ++; for (auto j : e[i]) vis[j] = 0; }