#include<bits/stdc++.h>
#include<iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <map>
#include <stack>
#include<bitset>
#include<list>
#include<cassert>
#include<numeric>

using namespace std;

const long long N = 1000 * 100 + 5;
long long c[N], n, cnt = 0, is, bi, nbi;
vector < long long > graph[N];
bool mark[N], b;
void dfs(long long v)
{
	mark[v] = 1;
	for (auto u : graph[v])
	{
		if (c[u] == c[v])
		{
			b = 0;
		}
		if (!mark[u])
		{
			c[u] = 1 - c[v];
			dfs(u);
		}
	}
	return;
}
void dfs2()
{
	memset(c , -1 , sizeof c);
	for(long long i = 0; i < n; i++)
	{
		if(!mark[i])
		{
			cnt++;
			b = 1;
			c[i] = 1;
			if(graph[i].size())
			{
				dfs(i);
				if(b)
				{
					bi++;
				}
				else
				{
					nbi++;
				}
			}
			else
			{
				is++;
			}
		}
	}
	return;
}
int main()
{
	long long m;
	cin >> n >> m;
	for (long long i = 0; i < m; i++)
	{
		long long u, v;
		cin >> u >> v;
		graph[u - 1].push_back(v - 1);
		graph[v - 1].push_back(u - 1);
	}
	dfs2();
	cout << (bi + nbi) * (bi + nbi) + bi * bi + 2 * n * is - is * is << endl;
}

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

typedef long long s64;
s64 C2(int n)
{
	return (s64)n*(n-1)/2;
}
#define rep(i,l,r) for(int i=l;i<=r;++i)
const int N=1e5+5;
int fa[N],sz[N];bool d[N],have[N];
int find(int x)
{
	if(fa[x]==x)return x;
	find(fa[x]);
	d[x]^=d[fa[x]];
	return fa[x]=fa[fa[x]];
}

int main()
{
	//freopen("1.in","r",stdin);
	int n,m;
	cin>>n>>m;
	rep(i,1,n){fa[i]=i;sz[i]=1;}
	while(m--)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		int fx=find(x),fy=find(y);
		if(fx==fy)
		{
			have[fx]|=d[x]==d[y];
			continue;
		}
		fa[fy]=fx;d[fy]=d[x]^1^d[y];
		sz[fx]+=sz[fy];
		have[fx]|=have[fy];
	}
	int cnt1=0,cnt[2]={};
	rep(x,1,n)
	if(fa[x]==x)
	if(sz[x]==1)++cnt1;
	else ++cnt[have[x]];
	cout<<(s64)cnt[1]*cnt[0]*2+(s64)cnt1*(n-cnt1)*2
		+(s64)cnt[1]*cnt[1]+(s64)cnt[0]*cnt[0]*2+(s64)cnt1*cnt1;
}