n,m=map(int,input().split()) F=[[] for i in range(n)] for i in range(m): a,b=map(int,input().split()) a-=1 b-=1 F[a].append(b) F[b].append(a) ANS=n*(n-1)*(n-2)//6 Distance=[[float("inf") for i in range(n)] for j in range(n)] for i in range(n): Distance[i][i]=0 for to in F[i]: Distance[i][to]=1 for k in range(n): # k個までの町を使ってのDisが知れているときに for i in range(n): # 町iと for j in range(i,n): # 町jとの最短距離は、 length=Distance[i][k]+Distance[j][k] if Distance[i][j]>length: Distance[i][j]=Distance[j][i]=length for i in range(n): for j in range(i+1,n): for k in range(j+1,n): if Distance[i][j]==2 or Distance[i][k]==2 or Distance[j][k]==2: ANS-=1 print(ANS)