#include<bits/stdc++.h>
using namespace std;

struct edge{
	int nxt,to;
}e[200005];
int n,m,c1,c2,ft[100005],c[100005];
long long ans;
bool v[100005],f;
void dfs(int x){
	v[x]=1;
	if(c[x]==1)c1++;else c2++;
	for(int i=ft[x];i;i=e[i].nxt)if(!c[e[i].to]){
		c[e[i].to]=3-c[x];
		dfs(e[i].to);
	}else if(c[e[i].to]==c[x])f=0;
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int a,b;scanf("%d%d",&a,&b);
		e[i<<1]=(edge){ft[a],b};ft[a]=i<<1;
		e[i<<1|1]=(edge){ft[b],a};ft[b]=i<<1|1;
	}
	for(int i=1;i<=n;i++)if(!v[i]){
		c[i]=1;f=1;c1=c2=0;
		dfs(i);
		if(f)ans+=1ll*c1*c2;else ans+=1ll*(c1+c2)*(c1+c2-1)/2;
	}
	printf("%lld\n",ans-m);
	return 0;
}