#include<cstdio>
#include<algorithm>
#include<bitset>
#include<cctype>
#define N 400001
using namespace std;
int inline read(){
int ans=0,f=1;char ch=getchar();
while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
while(isdigit(ch)){ans=ans*10+ch-'0';ch=getchar();}
return ans*f;
}
int head[N],to[N],nxt[N],tot,n,m,ans;
bitset<100001>a,b;
void add(int u,int v){
to[++tot]=v;
nxt[tot]=head[u];
head[u]=tot;
}
signed main(){
n=read(),m=read();
for(int i=1;i<=m;i++){
int a,b;
a=read(),b=read();
add(a,b);
add(b,a);
}
for(int x=1;x<=n;x++){
a.reset();
for(int i=head[x];i;i=nxt[i]){int y=to[i];if(!b[y])a[y]=1;}
for(int i=head[x];i;i=nxt[i]){
int y=to[i];
if(b[y])continue;
for(int j=head[y];j;j=nxt[j]){
int z=to[j];
if(b[z])continue;
if(a[z])ans++;
}
}
b[x]=1;
}
printf("%d",ans/2);
return 0;
}