#include<bits/stdc++.h>usingnamespace std;typedeflonglong ll;//三年竞赛一场空,不开long long见祖宗 //typedef __int128 lll;#define print(i) cout << "debug: " << i << endl#define close() ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)#define mem(a, b) memset(a, b, sizeof(a))#define x first#define y secondtypedef pair<int,int> par;const ll mod =1e9+7;constint maxn =1e6+10;constint inf =0x3f3f3f3f;
par a[maxn];int d[maxn];
vector<int> g[maxn];int vis[maxn];intmain(){int n, m; cin >> n >> m;for(int i =1; i <= m; i++)
cin >> a[i].x >> a[i].y, d[a[i].x]++, d[a[i].y]++;for(int i =1; i <= m; i++){int x = a[i].x, y = a[i].y;if(d[x]> d[y]|| d[x]== d[y]&& x > y)swap(x, y);
g[x].push_back(y);}int ans =0;for(int i =1; i <= n; i++){for(int j : g[i]) vis[j]= i;for(int j : g[i])for(int k : g[j])if(vis[k]== i)
ans++;}
cout << ans << endl;}