#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>
#include <algorithm>
#include <time.h>
#define l(x) x<<1
#define r(x) ((x<<1) | 1)
#define x first
#define y second
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
const int inf = 2*(1e9) + 10;
const long long MOD =998244353;
const int NMAX = 1000005;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};

vector<int> G[NMAX];
int viz[NMAX], color[NMAX];
bool bip;

int dfs(int v, int p){
    for(auto el: G[v]){
        if(el == p){
            continue;
        }
        if(viz[el]){
            if(color[el] != 1-color[v]){
                bip = 0;
            }
        } else {
            color[el] = 1 - color[v];
            viz[el] = 1;
            dfs(el, v);
        }
    }
}

int main(){
    int n, m;
    cin>>n>>m;

    for(int i = 1; i<=m; ++i){
        int a, b;
        cin>>a>>b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    LL ans = 0;
    LL sum = 0;
    LL ons = 0;
    LL bp = 0;
    LL bm = 0;
    for(int i=1; i<=n; ++i){

        if(G[i].size() == 0){
            ons++;
            continue;
        }
        if(viz[i]){ continue;}
        bip = 1;
        viz[i] = 1;
        dfs(i, 0);
        if(bip){
            bp++;
        } else bm++;
    }
    cout<<2*ons*n - ons*ons + bm*bm + 2*bm*bp + 2*bp*bp<<"\n";

    return 0;
}
