#pragma comment(linker, "/stack:20000000")
#define _CRT_SECURE_NO_WARNINGS
# include <iostream>
# include <cmath>
# include <algorithm>
# include <cstdio>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <deque>
# include <functional>
# include <sstream>
# include <fstream>
# include <complex>
# include <numeric>
# include <immintrin.h>
using namespace std;
// Let's define unordered map
# ifdef __GNUC__
# if __cplusplus > 199711L
# include <unordered_set>
# include <unordered_map>
# else
# include <tr1/unordered_map>
# include <tr1/unordered_set>
using namespace std:: tr1 ;
# endif
# else
# include <unordered_map>
# include <unordered_set>
# endif
#define VA_NUM_ARGS(...) VA_NUM_ARGS_IMPL_((0,__VA_ARGS__, 5,4,3,2,1))
#define VA_NUM_ARGS_IMPL_(tuple) VA_NUM_ARGS_IMPL tuple
#define VA_NUM_ARGS_IMPL(_0,_1,_2,_3,_4,_5,N,...) N
#define macro_dispatcher(macro, ...) macro_dispatcher_(macro, VA_NUM_ARGS(__VA_ARGS__))
#define macro_dispatcher_(macro, nargs) macro_dispatcher__(macro, nargs)
#define macro_dispatcher__(macro, nargs) macro_dispatcher___(macro, nargs)
#define macro_dispatcher___(macro, nargs) macro ## nargs
#define DBN1(a) std::cerr<<#a<<"="<<(a)<<"\n"
#define DBN2(a,b) std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n"
#define DBN3(a,b,c) std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define DBN4(a,b,c,d) std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"
#define DBN5(a,b,c,d,e) std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<"\n"
#define DBN(...) macro_dispatcher(DBN, __VA_ARGS__)(__VA_ARGS__)
#define DA(a,n) cout<<#a<<"=["; printarray(a,n); cout<<"]\n"
#define DAR(a,n,s) cout<<#a<<"["<<s<<"-"<<n-1<<"]=["; printarray(a,n,s); cout<<"]\n"
#ifdef _MSC_VER
#define ALIGN(x) __declspec(align(x))
#else
#define ALIGN(x) __attribute__((aligned(x)))
#endif
#define CURTIME() cerr << clock() * 1.0 / CLOCKS_PER_SEC << std::endl
double __begin;
#define DTIME(ccc) __begin = clock(); ccc; std::cerr<<"Time of work = "<<(clock()-__begin)/CLOCKS_PER_SEC<<std::endl;
#define mp make_pair
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair< int , int > pii;
typedef pair< long long , long long > pll;
typedef vector< int > vi;
typedef vector< long long > vll;
template < typename T1, typename T2, typename T3>
struct triple{ T1 a; T2 b; T3 c; triple( ) { } ; triple( T1 _a, T2 _b, T3 _c) : a( _a) , b( _b) , c( _c) { } } ;
#define tri triple<int,int,int>
#define trll triple<ll,ll,ll>
template < typename T1, typename T2, typename T3>
bool operator< ( const triple< T1, T2, T3> & t1, const triple< T1, T2, T3> & t2) { if ( t1.a ! = t2.a ) return t1.a < t2.a ; else if ( t1.b ! = t2.b ) return t1.b < t2.b ; else return t1.c < t2.c ; }
template < typename T1, typename T2, typename T3>
inline std:: ostream & operator << ( std:: ostream & os, const triple< T1, T2, T3> & t) { return os << "(" << t.a << ", " << t.b << ", " << t.c << ")" ; }
#define FI(n) for(int i=0;i<n;i++)
#define FJ(n) for(int j=0;j<n;j++)
#define all(a) a.begin(), a.end()
//int some_primes[10] = {100271, 500179, 1000003, 2000227, 5000321}
inline int bits_count( int v) { v = v - ( ( v >> 1 ) & 0x55555555 ) ; v = ( v & 0x33333333 ) + ( ( v >> 2 ) & 0x33333333 ) ; return ( ( v + ( v >> 4 ) & 0xF0F0F0F ) * 0x1010101 ) >> 24 ; }
inline int bits_count( ll v) { int t = v >> 32 ; int p = ( v & ( ( 1LL << 32 ) - 1 ) ) ; return bits_count( t) + bits_count( p) ; }
unsigned int reverse_bits( register unsigned int x) { x = ( ( ( x & 0xaaaaaaaa ) >> 1 ) | ( ( x & 0x55555555 ) << 1 ) ) ; x = ( ( ( x & 0xcccccccc ) >> 2 ) | ( ( x & 0x33333333 ) << 2 ) ) ; x = ( ( ( x & 0xf0f0f0f0 ) >> 4 ) | ( ( x & 0x0f0f0f0f ) << 4 ) ) ; x = ( ( ( x & 0xff00ff00 ) >> 8 ) | ( ( x & 0x00ff00ff ) << 8 ) ) ; return ( ( x >> 16 ) | ( x << 16 ) ) ; }
inline int sign( int x) { return x > 0 ; }
inline bool isPowerOfTwo( int x) { return ( x ! = 0 && ( x& ( x - 1 ) ) == 0 ) ; }
#define checkbit(n,b) ( (n >> b) & 1)
#define reunique(v) v.resize(std::unique(v.begin(), v.end()) - v.begin())
//STL output ********************************
template < typename T1, typename T2> inline std:: ostream & operator << ( std:: ostream & os, const std:: pair < T1, T2> & p) { return os << "(" << p.first << ", " << p.second << ")" ; }
template < typename T> inline std:: ostream & operator<< ( std:: ostream & os, const std:: vector < T> & v) { bool first = true ; os << "[" ; for ( unsigned int i = 0 ; i< v.size ( ) ; i++ ) { if ( ! first) os << ", " ; os << v[ i] ; first = false ; } return os << "]" ; }
template < typename T> inline std:: ostream & operator<< ( std:: ostream & os, const std:: set < T> & v) { bool first = true ; os << "[" ; for ( typename std:: set < T> :: const_iterator ii = v.begin ( ) ; ii ! = v.end ( ) ; ++ ii) { if ( ! first) os << ", " ; os << * ii; first = false ; } return os << "]" ; }
template < typename T1, typename T2> inline std:: ostream & operator << ( std:: ostream & os, const std:: map < T1, T2> & v) { bool first = true ; os << "[" ; for ( typename std:: map < T1, T2> :: const_iterator ii = v.begin ( ) ; ii ! = v.end ( ) ; ++ ii) { if ( ! first) os << ", " ; os << * ii; first = false ; } return os << "]" ; }
template < typename T, typename T2> void printarray( T a[ ] , T2 sz, T2 beg = 0 ) { for ( T2 i = beg; i< sz; i++ ) cout << a[ i] << " " ; cout << endl; }
#define FREIN(FILE) freopen(FILE,"rt",stdin)
#define FREOUT(FILE) freopen(FILE,"wt",stdout)
#define sqr(x) ((x)*(x))
#define sqrt(x) sqrt(1.0*(x))
#define pow(x,n) pow(1.0*(x),n)
inline ll mulmod( ll x, ll n, ll _mod) { ll res = 0 ; while ( n) { if ( n & 1 ) res = ( res + x) % _mod; x = ( x + x) % _mod; n >>= 1 ; } return res; }
inline ll powmod( ll x, ll n, ll _mod) { ll res = 1 ; while ( n) { if ( n & 1 ) res = ( res* x) % _mod; x = ( x* x) % _mod; n >>= 1 ; } return res; }
inline ll gcd( ll a, ll b) { ll t; while ( b) { a = a% b; t = a; a = b; b = t; } return a; }
inline int gcd( int a, int b) { int t; while ( b) { a = a% b; t = a; a = b; b = t; } return a; }
inline ll lcm( ll a, ll b) { return a / gcd( a, b) * b; }
inline ll gcd( ll a, ll b, ll c) { return gcd( gcd( a, b) , c) ; }
inline int gcd( int a, int b, int c) { return gcd( gcd( a, b) , c) ; }
template < class T>
inline void getar( T a, int n, int m) { for ( int i = 0 ; i < n; i++ ) for ( int j = 0 ; j< m; ++ j) { scanf ( "%d" , & a[ i] [ j] ) ; } }
inline void getar( int * a, int n) { for ( int ii = 0 ; ii < n; ii++ ) { scanf ( "%d" , a + ii) ; } }
inline void getar( pii * a, int n) { for ( int ii = 0 ; ii < n; ii++ ) { scanf ( "%d%d" , & a[ ii] .first , & a[ ii] .second ) ; } }
inline void getar( ll * a, int n) { for ( int ii = 0 ; ii < n; ii++ ) { scanf ( "%I64d" , a + ii) ; } }
template < class T>
inline void cinarr( T & a, int n) { for ( int i = 0 ; i< n; ++ i) cin >> a[ i] ; }
// Useful constants
#define INF 1011111111
#define LLINF 1000111000111000111LL
#define EPS (double)1e-10
#define mod 1000000007
#define PI 3.14159265358979323
#define link asaxlaj
//*************************************************************************************
vector< int > v[ 32 ] ;
int bc[ 32 ] ;
vector< int > t[ 2 ] ;
vector< int > c[ 2 ] ;
bool used[ 101 ] ;
int cbc[ 1 << 16 ] ;
void go( int cur, int color) {
used[ cur] = true ;
c[ color] .push_back ( cur) ;
for ( int to : v[ cur] ) {
if ( ! used[ to] ) {
go( to, 1 - color) ;
}
}
}
int main( ) {
int n, m;
cin >> n >> m;
for ( int i = 0 ; i < m; ++ i) {
int x, y;
cin >> x >> y;
-- x; -- y;
v[ x] .push_back ( y) ;
v[ y] .push_back ( x) ;
bc[ x] | = ( 1 << y) ;
bc[ y] | = ( 1 << x) ;
}
for ( int i = 0 ; i < n; ++ i) {
if ( ! used[ i] ) {
go( i, 0 ) ;
if ( c[ 0 ] .size ( ) > c[ 1 ] .size ( ) ) {
c[ 0 ] .swap ( c[ 1 ] ) ;
}
for ( int j = 0 ; j < 2 ; ++ j) {
while ( c[ j] .size ( ) ) {
t[ j] .push_back ( c[ j] .back ( ) ) ;
c[ j] .pop_back ( ) ;
}
}
}
}
int ts = ( int ) t[ 0 ] .size ( ) ;
int k = ( 1 << ts) ;
for ( int mask = 0 ; mask < k; ++ mask) {
for ( int i = 0 ; i < ts; ++ i) {
if ( checkbit( mask, i) ) {
cbc[ mask] | = bc[ t[ 0 ] [ i] ] ;
}
}
}
int ans = 0 ;
int fk = k - 1 ;
while ( k-- ) {
int canBeBad = cbc[ k] ;
int revk = fk ^ k;
int steps = 1 << bits_count( revk) ;
for ( int sm = revk; steps-- ; sm = ( sm - 1 ) & revk) {
int mustBeBad = cbc[ sm] ;
if ( ( mustBeBad & canBeBad) ! = mustBeBad) {
continue ;
}
int vars = 1 << bits_count( mustBeBad ^ canBeBad) ;
if ( bits_count( sm) & 1 ) {
ans - = vars;
} else {
ans + = vars;
}
}
}
cout << ans << endl;
return 0 ;
}
I3ByYWdtYSBjb21tZW50KGxpbmtlciwgIi9zdGFjazoyMDAwMDAwMCIpCiNkZWZpbmUgX0NSVF9TRUNVUkVfTk9fV0FSTklOR1MKIyBpbmNsdWRlIDxpb3N0cmVhbT4KIyBpbmNsdWRlIDxjbWF0aD4KIyBpb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Zm9yIChpbnQgaWkgPSAwOyBpaSA8IG47IGlpKyspeyBzY2FuZigiJUk2NGQiLCBhICsgaWkpOyB9IH0KdGVtcGxhdGU8Y2xhc3MgVD4KaW5saW5lIHZvaWQgY2luYXJyKFQgJmEsIGludCBuKXsgZm9yIChpbnQgaSA9IDA7IGk8bjsgKytpKSBjaW4gPj4gYVtpXTsgfQovLyBVc2VmdWwgY29uc3RhbnRzCgojZGVmaW5lIElORiAgICAgICAgIDEwMTExMTExMTEKI2RlZmluZSBMTElORiAgICAgICAxMDAwMTExMDAwMTExMDAwMTExTEwKI2RlZmluZSBFUFMgICAgICAgICAoZG91YmxlKTFlLTEwCiNkZWZpbmUgbW9kICAgICAgICAgMTAwMDAwMDAwNwojZGVmaW5lIFBJICAgICAgICAgIDMuMTQxNTkyNjUzNTg5NzkzMjMKI2RlZmluZSBsaW5rICAgICAgICBhc2F4bGFqCi8vKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoKdmVjdG9yPGludD4gdlszMl07CmludCBiY1szMl07CnZlY3RvcjxpbnQ+IHRbMl07CnZlY3RvcjxpbnQ+IGNbMl07CmJvb2wgdXNlZFsxMDFdOwppbnQgY2JjWzEgPDwgMTZdOwp2b2lkIGdvKGludCBjdXIsIGludCBjb2xvcikgewogICAgdXNlZFtjdXJdID0gdHJ1ZTsKICAgIGNbY29sb3JdLnB1c2hfYmFjayhjdXIpOwogICAgZm9yIChpbnQgdG8gOiB2W2N1cl0pIHsKICAgICAgICBpZiAoIXVzZWRbdG9dKSB7CiAgICAgICAgICAgIGdvKHRvLCAxIC0gY29sb3IpOwogICAgICAgIH0KICAgIH0KfQppbnQgbWFpbigpIHsKICAgIGludCBuLCBtOwogICAgY2luID4+IG4gPj4gbTsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbTsgKytpKSB7CiAgICAgICAgaW50IHgsIHk7CiAgICAgICAgY2luID4+IHggPj4geTsKICAgICAgICAtLXg7IC0teTsKICAgICAgICB2W3hdLnB1c2hfYmFjayh5KTsKICAgICAgICB2W3ldLnB1c2hfYmFjayh4KTsKICAgICAgICBiY1t4XSB8PSAoMSA8PCB5KTsKICAgICAgICBiY1t5XSB8PSAoMSA8PCB4KTsKICAgIH0KICAgIAogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyArK2kpIHsKICAgICAgICBpZiAoIXVzZWRbaV0pIHsKICAgICAgICAgICAgZ28oaSwgMCk7CiAgICAgICAgICAgIGlmIChjWzBdLnNpemUoKSA+IGNbMV0uc2l6ZSgpKSB7CiAgICAgICAgICAgICAgICBjWzBdLnN3YXAoY1sxXSk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCAyOyArK2opIHsKICAgICAgICAgICAgICAgIHdoaWxlIChjW2pdLnNpemUoKSkgewogICAgICAgICAgICAgICAgICAgIHRbal0ucHVzaF9iYWNrKGNbal0uYmFjaygpKTsKICAgICAgICAgICAgICAgICAgICBjW2pdLnBvcF9iYWNrKCk7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9CiAgICBpbnQgdHMgPSAoaW50KXRbMF0uc2l6ZSgpOwogICAgaW50IGsgPSAoMSA8PCB0cyk7CiAgICBmb3IgKGludCBtYXNrID0gMDsgbWFzayA8IGs7ICsrbWFzaykgewogICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgdHM7ICsraSkgewogICAgICAgICAgICBpZiAoY2hlY2tiaXQobWFzaywgaSkpIHsKICAgICAgICAgICAgICAgIGNiY1ttYXNrXSB8PSBiY1t0WzBdW2ldXTsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIGludCBhbnMgPSAwOwogICAgaW50IGZrID0gayAtIDE7CiAgICB3aGlsZSAoay0tKSB7CiAgICAgICAgaW50IGNhbkJlQmFkID0gY2JjW2tdOwogICAgICAgIGludCByZXZrID0gZmsgXiBrOwogICAgICAgIGludCBzdGVwcyA9IDEgPDwgYml0c19jb3VudChyZXZrKTsKICAgICAgICBmb3IgKGludCBzbSA9IHJldms7IHN0ZXBzLS07IHNtID0gKHNtIC0gMSkgJiByZXZrKSB7CiAgICAgICAgICAgIGludCBtdXN0QmVCYWQgPSBjYmNbc21dOwogICAgICAgICAgICBpZiAoKG11c3RCZUJhZCAmIGNhbkJlQmFkKSAhPSBtdXN0QmVCYWQpIHsKICAgICAgICAgICAgICAgIGNvbnRpbnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGludCB2YXJzID0gMSA8PCBiaXRzX2NvdW50KG11c3RCZUJhZCBeIGNhbkJlQmFkKTsKICAgICAgICAgICAgaWYgKGJpdHNfY291bnQoc20pICYgMSkgewogICAgICAgICAgICAgICAgYW5zIC09IHZhcnM7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBhbnMgKz0gdmFyczsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIGNvdXQgPDwgYW5zIDw8IGVuZGw7CiAgICAKICAgIHJldHVybiAwOwp9Cg==