// Slower C++ solution:
#include <iostream>

#include <sstream>

#include <iomanip>

#include <cstdio>

#include <cstdlib>

#include <cmath>

#include <cctype>

#include <cstring>

#include <vector>

#include <list>

#include <queue>

#include <deque>

#include <stack>

#include <map>

#include <set>

#include <algorithm>

#include <iterator>

#include <bitset>

#include <ctime>

using namespace std;



#define F(i, n) for(int i = 0; i < n; ++i)

#define FOR(i,a,b) for (int i = (a); i < (b); i++)

#define RFOR(i,b,a) for (int i = (b)-1; i >= (a); i--)

#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)

#define FILL(a,value) memset(a, value, sizeof(a))



#define SZ(a) (int)a.size()

#define ALL(a) a.begin(), a.end()

#define PB push_back

#define MP make_pair



typedef long long LL;

typedef vector<int> VI;

typedef pair<int, int> PII;



const double PI = acos(-1.0);

const int INF = 1000 * 1000 * 1000 + 7;

const LL LINF = INF * (LL) INF;



const int MAX =2*100000 + 47;



VI G[MAX];

int C[MAX];

int cnt[MAX];

bool b;



void dfs(int v, int c)

{

    C[v] = c;

    cnt[c]++;

    FOR(i, 0, SZ(G[v]))

    {

        int to = G[v][i];

        if (C[to] != -1)

        {

            if (C[to] == C[v])

                b =  false;

            continue;

        }

        

        dfs(to, c ^ 1);

        

    }

}





int main()

{

    //freopen("in.txt", "r", stdin);

    int n, m;

    scanf("%d%d", &n, &m);

    FOR(i, 0, m)

    {

        int x, y;

        scanf("%d%d", &x, &y);

        --x, --y;

        G[x].PB(y);

        G[y].PB(x);

    }

    FILL(C, -1);

    

    LL NB = 0;

    LL C1 = 0, CC = 0;

    

    FOR(i, 0, n)

        if (C[i] == -1)

        {

            cnt[0] = cnt[1] = 0;

            b = 1;

            dfs(i, 0);

            if (!b)++NB;

            else

            {

                if (!cnt[1])++C1;

                else ++CC;

            }

        }

    

    LL res = NB * NB;

    res += 2 * CC * CC;

    res += 2 * CC * NB;

    res += 2 * C1 * n  - C1 * C1;

    cout << res << endl;

    

    

}




// Faster C++ solution for the same problem (measured speedup: 1.8594178171840523x):
#include<cstdio>

#include<cstring>

#include<algorithm>

#include<vector>

#define MAXN 100000

using namespace std;

typedef long long LL;

struct edge

{

	int u,v;

	edge(){};

	edge(int _u,int _v):u(_u),v(_v){};

};

vector<edge> G[MAXN+5],edges;

int setfa[MAXN+5],setsp[MAXN+5],d[MAXN+5];

int dist[MAXN+5],n,m;

bool vis[MAXN+5];

void Init()

{

	for(int i=0;i<=MAXN;i++)

		setfa[i]=i;

}

int Findfa(int x)

{

	if(x==setfa[x])

		return x;

	return setfa[x]=Findfa(setfa[x]);

}

void Union(int x,int y)

{

	int fx=Findfa(x),fy=Findfa(y);

	if(fx==fy)

		return;

	setfa[fx]=fy;

}

void DFS(int u)

{

	for(int i=0;i<(int)G[u].size();i++)

	{

		int v=G[u][i].v;

		if(dist[v]!=0)

		{

			int cirlen=dist[u]-dist[v]+1;

			if(cirlen%2==1)

				setsp[Findfa(u)]=true;

			continue;

		}

		dist[v]=dist[u]+1;

		DFS(v);

	}

}

int main()

{

//	freopen("squared.in","r",stdin);

//	freopen("squared.out","w",stdout);

	Init();

	scanf("%d %d",&n,&m);

	int u,v;

	for(int i=1;i<=m;i++)

	{

		scanf("%d %d",&u,&v);

		G[u].push_back(edge(u,v));

		G[v].push_back(edge(v,u));

		edges.push_back(edge(u,v));

		d[u]++,d[v]++;

		Union(u,v);

	}

	for(int i=1;i<=n;i++)

		if(dist[i]==0)

		{

			dist[i]=1;

			DFS(i);

		}

	LL ans=0,num=0,num2=0;

	for(int i=1;i<=n;i++)

		if(vis[Findfa(i)]==false)

		{

			vis[Findfa(i)]=true;

			if(d[i]==0)

				continue;

			num++;

			if(setsp[Findfa(i)]==true)

				num2++;

			else

				num2+=2;

		}

	memset(vis,0,sizeof(vis));

	LL cnt=0;

	for(int i=1;i<=n;i++)

		if(vis[Findfa(i)]==false)

		{

			vis[Findfa(i)]=true;

			if(d[i]==0)

			{

				ans+=1LL*n;

				cnt+=1LL;

				continue;

			}

			if(setsp[Findfa(i)]==true)

				ans+=1LL*num;

			else

				ans+=1LL*num2;

		}

	ans+=cnt*(n-cnt);

	printf("%lld\n",ans);

	return 0;

}