#include<cstdio>
inline int read()
{
	int x;char c;
	while((c=getchar())<'0'||c>'9');
	for(x=c-'0';(c=getchar())>='0'&&c<='9';)x=x*10+c-'0';
	return x;
}
#define MN 100000
#define MM 200000
struct edge{int nx,t;}e[MM*2+5];
int h[MN+5],en,d[MN+5],o;
inline void ins(int x,int y)
{
	e[++en]=(edge){h[x],y};h[x]=en;
	e[++en]=(edge){h[y],x};h[y]=en;
}
void dfs(int x)
{
	for(int i=h[x];i;i=e[i].nx)
		if(d[e[i].t])o|=d[x]==d[e[i].t];
		else d[e[i].t]=3-d[x],dfs(e[i].t);
}
int main()
{
	int n=read(),m=read(),i,s1=0,s2=0,s3=0;
	while(m--)ins(read(),read());
	for(i=1;i<=n;++i)if(!d[i])
	{
		if(!h[i]){++s1;continue;}
		o=0;d[i]=1;dfs(i);
		if(o)++s3;else ++s2;
	}
	printf("%lld",2LL*n*s1-1LL*s1*s1+2LL*s2*s2+1LL*s3*(s2+s3)+1LL*s2*s3);
}