#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
typedef long long ll;
const int maxn=100000+10;
int fa[maxn],co[maxn];
bool bz[maxn],pd[maxn];
int i,j,k,l,r,t,n,m,cnt;
ll ans;
int getfa(int x){
    if (!fa[x]) return x;
    int t=getfa(fa[x]);
    co[x]^=co[fa[x]];
    return fa[x]=t;
}
int main(){
    scanf("%d%d",&n,&m);
    fo(i,1,m){
        scanf("%d%d",&j,&k);
        bz[j]=1;bz[k]=1;
        l=getfa(j);r=getfa(k);
        if (l<r){
            swap(l,r);
            swap(j,k);
        }
        if (l==r&&co[j]==co[k]) pd[l]=1;
        if (l==r) continue;
        pd[r]|=pd[l];
        fa[l]=r;
        co[l]=co[j]^co[k]^1;
    }
    fo(i,1,n)
        if (!bz[i]) cnt++;
    ans=(ll)cnt*(n-cnt)*2+(ll)cnt*cnt;
    cnt=0;
    fo(i,1,n)
        if (bz[i]&&!fa[i]) cnt++;
    ans+=(ll)cnt*cnt;
    cnt=0;
    fo(i,1,n)
        if (bz[i]&&!fa[i]&&!pd[i]) cnt++;
    fo(i,1,n)
        if (bz[i]&&!fa[i]&&!pd[i]) ans+=(ll)cnt;
    printf("%lld\n",ans);
}
#include <bits/stdc++.h>
using namespace std;
int col[100005];
vector<int> v[100005];
bool dfs(int node,int c)
{
	if (col[node]!=-1)
	return (col[node]==c);
	col[node]=c;
	bool ok=1;
	for (int u:v[node])
	ok&=dfs(u,!c);
	return ok;
}
int main()
{
	int n,m,c=0,b=0;
	scanf("%d%d",&n,&m);
	while (m--)
	{
		int a,b;
		scanf("%d%d",&a,&b);
		v[a].push_back(b);
		v[b].push_back(a);
	}
	memset(col,-1,sizeof(col));
	int nn=n;
	long long ans=0;
	for (int i=1;i<=n;i++)
	{
		if (v[i].empty())
		{
			ans+=2*nn-1;
			nn--;
			continue;
		}
		if (col[i]==-1)
		{
			c++;
			b+=dfs(i,0);
		}
	}
	printf("%lld",ans+1LL*c*c+1LL*b*b);
}