// Original C++ solution (slower):
#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;

    

    

}




// Optimized solution to the same problem (faster):
#define _CRT_SECURE_NO_WARNINGS

#include <vector>

#include <iostream>

#include <string.h>

#include <set>

#include <algorithm>

#include <cmath>

#include <queue>

using namespace std;



typedef double LD;

typedef long long LL;

typedef pair<int, int> PII;

#define MP make_pair

#define PB push_back

#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 REP(i, t) FOR(i,0,t)

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

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



const LL MOD = 1000000007;

const int INF = 1e9;

const LL LINF = 1LL * INF * INF;

const int MAXN = 100007;

const LD EPS = 1e-7;



vector <int> G[MAXN];

bool bip, used[MAXN];

int col[MAXN];



void dfs(int v)

{

	used[v] = true;

	REP(i, SZ(G[v]))

	{

		int to = G[v][i];

		if (!used[to])

		{

			col[to] = 3 - col[v];

			dfs(to);

		}

		if (col[to] != 3 - col[v])

			bip = false;

	}

}



int main()

{

	ios_base::sync_with_stdio(0);

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

	int n, m;	

	cin >> n >> m;

	REP(i, m)

	{

		int u, v;

		cin >> u >> v;

		--u; --v;

		G[u].push_back(v);

		G[v].push_back(u);

	}

	LL b = 0, c = 0, c1 = 0;

	REP(i, n)

	{

		if (SZ(G[i]) == 0)

		{

			++c1;

			continue;

		}

		if (!used[i])

		{

			bip = true;

			col[i] = 1;

			dfs(i);

			if (bip)

				++b;

			++c;

		}

	}

	cout << c * c + b * b + c1 * (2 * n - c1);

	//cout << endl; system("pause");

	return 0;

}

// Fastest known solution for this problem: