#include <cstdio>
typedef long long LL;
const int MAXN = 1e5+1;
const int MAXM = 4e5+1;
struct Edge
{
	int to;
	Edge *next;
	Edge(){}
	Edge(int v, Edge *e):to(v),next(e){}
	void* operator new(size_t);
}EData[MAXM], *head[MAXN];
void* Edge::operator new(size_t)
{
	static Edge *P = EData;
	return P++;
}
void addEdge(int a, int b)
{
	head[a] = new Edge(b, head[a]);
	head[b] = new Edge(a, head[b]);
}
int size[MAXN], col[MAXN];
bool dfs(int p, int from, int c = 1)
{
	size[p] = 1;
	col[p] = c;
	bool flag = 1;
	for(Edge *e=head[p]; e; e=e->next)
		if(!col[e->to])
		{
			flag &= dfs(e->to, p, -c);
			size[p] += size[e->to];
		}
		else if(col[e->to] == c)
			flag = 0;
	return flag;
}
int main()
{
	int N, M, i, x, y, z, a, b;
	scanf("%d%d", &N, &M);
	for(i=0; i<M; ++i)
	{
		scanf("%d%d", &a, &b);
		addEdge(a, b);
	}
	x = y = z = 0;
	for(i=1; i<=N; ++i)
		if(!col[i])
		{
			bool f = dfs(i, i);
			if(size[i] == 1) ++x;
			else if(f) ++y;
			else ++z;
		}
	printf("%lld\n", LL(2*N-x)*x + LL(y+z)*y*2 + LL(z)*z);
}