#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define int long long int
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define ss(s)   scanf("%s",s)
#define pi(x)   printf("%d\n",x)
#define pl(x)   printf("%lld\n",x)
#define ps(s)   printf("%s\n",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define INF 1e9+7
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
int mpow(int base, int exp);
void ipgraph(int m);
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
const int mod = 1000000007;
const int N = 2e5+5, M = N;
//=========================================

int fact[1005];

void preprocess(){
    fact[1] = fact[0] = 1;
    for(int i = 2; i <= 1000; ++i)
        fact[i] = fact[i - 1] * i % mod;
}

int pwmod(int a, int b){
    a %= mod;
    int res = 1;
    while(b){
        if(b & 1)
            res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

int modInv(int x){
    return pwmod(x, mod - 2);
}

int nCr(int n, int k){
    return fact[n] * modInv(fact[n - k]) % mod * modInv(fact[k]) % mod;
}

int32_t main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("inputf.in", "r", stdin);
    freopen("outputf.in", "w", stdout);
    #endif

    preprocess();

    int n, m;
    cin >> n >> m;

    // a1, a2, a3, ... am, bm, bm-1, ... b2, b1
    // total digits 2 * m
    // value of each digit -> [1 - n]
    // Applying stars and bars algorithm

    int ans = nCr(2 * m + n - 1, 2 * m);
    cout << ans << endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define int long long int
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define ss(s)   scanf("%s",s)
#define pi(x)   printf("%d\n",x)
#define pl(x)   printf("%lld\n",x)
#define ps(s)   printf("%s\n",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define INF 1e9+7
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
int mpow(int base, int exp);
void ipgraph(int m);
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
const int mod = 1e9 + 7;
const int N = 2e5+5, M = N;
//=========================================

int fact[N];

void preprocess(){
    fact[1] = fact[0] = 1;
    for(int i = 2; i <= 3000; ++i)
        fact[i] = (fact[i - 1] * i) % mod;
}

int pwmod(int a, int b){
    a %= mod;
    int res = 1;
    while(b){
        if(b & 1)
            res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

int modInv(int x){
    return pwmod(x, mod - 2);
}

int nCr(int n, int k){
    return fact[n] * modInv(fact[n - k]) % mod * modInv(fact[k]) % mod;
}

int32_t main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("inputf.in", "r", stdin);
    freopen("outputf.in", "w", stdout);
    #endif

    preprocess();

    int n, m;
    cin >> n >> m;

    // a1, a2, a3, ... am, bm, bm-1, ... b2, b1
    // total digits 2 * m
    // value of each digit -> [1 - n]
    // Applying stars and bars algorithm

    int ans = nCr(n + (2 * m) - 1, n - 1);
    cout << ans << endl;

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define int long long int
#define si(x)   scanf("%d",&x)
#define sl(x)   scanf("%lld",&x)
#define ss(s)   scanf("%s",s)
#define pi(x)   printf("%d\n",x)
#define pl(x)   printf("%lld\n",x)
#define ps(s)   printf("%s\n",s)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define INF 1e9+7
typedef pair<int, int>  pii;
typedef vector<int>     vi;
typedef vector<pii>     vpii;
typedef vector<vi>      vvi;
int mpow(int base, int exp);
void ipgraph(int m);
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, 1, 0, -1};
const int mod = 1000000007;
const int N = 2e5+5, M = N;
//=========================================

int fact[3005];

void preprocess(){
    fact[1] = fact[0] = 1;
    for(int i = 2; i <= 1000; ++i)
        fact[i] = fact[i - 1] * i % mod;
}

int pwmod(int a, int b){
    a %= mod;
    int res = 1;
    while(b){
        if(b & 1)
            res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}

int modInv(int x){
    return pwmod(x, mod - 2);
}

int nCr(int n, int k){
    return fact[n] * modInv(fact[n - k]) % mod * modInv(fact[k]) % mod;
}

int32_t main() {

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    #ifndef ONLINE_JUDGE
    freopen("inputf.in", "r", stdin);
    freopen("outputf.in", "w", stdout);
    #endif

    preprocess();

    int n, m;
    cin >> n >> m;

    // a1, a2, a3, ... am, bm, bm-1, ... b2, b1
    // total digits 2 * m
    // value of each digit -> [1 - n]
    // Applying stars and bars algorithm

    int ans = nCr(2 * m + n - 1, 2 * m);
    cout << ans << endl;

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod=1e9+7;
ll dp[2000][2000];
ll nCr(ll n , ll r){
   if(r==1) return n;
   if(n==r) return 1;
   if(dp[n][r]!=-1) return dp[n][r];
   dp[n][r]=(nCr(n-1,r)%mod+nCr(n-1,r-1)%mod)%mod;
   return dp[n][r];
}
int main()
{
    for(int i=0;i<1000;i++){
      memset(dp,-1,sizeof(dp));
    }
    ll n,m;
    cin>>n>>m;
    cout<<nCr(n+2*m-1,2*m)%mod<<endl;
}


#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
#define FOR(i, n) for(int i=0; i<(int)(n); ++i)

const int N = 100;
int n;

vector<vector<int>> vvi;
vector<int> vis(N, 0);

void dfs(int i, int &howM, int &initial, int &length) {
	if(vis[i]) return;
	++howM;
	vis[i] = 1;
	if(vvi[i].size()==1) {
		if(howM%2!=0) length--;
	} else if (vvi[i].size()==2) {
		FOR(j, 2) if(vvi[i][j]!=i) {
			if(vvi[i][j]==initial) {
				if(howM%2!=0) length--;
			} else dfs(vvi[i][j], howM, initial, length);
		}
	}
}

int main() {
	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("i.txt", "r", stdin);
    // for writing output to output.txt
    freopen("o.txt", "w", stdout);
    #endif
	int a;
	cin>>n>>a;
	vector<int> vi;
	FOR(i, n) vvi.push_back(vi);
	while(a--) {
		int from, to;
		cin>>from>>to;
		--from; --to;
		vvi[from].push_back(to);
		vvi[to].push_back(from);
	}
	int howM = 1;
	int length = 0;
	FOR(i, n) {
			howM = 1;
			dfs(i, howM, i, length);
	}
	cout<<abs(length);

}


#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
#define FOR(i, n) for(int i=0; i<(int)(n); ++i)

const int N = 100;
int n, length = 0;

vector<vector<int>> vvi;
vector<int> vis(N, 0);
void dfs(int cur, int par, int &initial, int &cnt) {
	if(cur == initial&&par != -1) {
		if(cnt%2) length++;
	}
	if(vis[cur]) return;
	vis[cur] = 1;
	++cnt;
	if (vvi[cur].size()==1) {
		if(par = -1) {
			dfs(vvi[cur][0], cur, initial, cnt);
		} else {
			if(cnt%2) length++;
		}
	} else if (vvi[cur].size()==2) {
		FOR(j, vvi[cur].size()) if(vvi[cur][j] != par) {
			int cntL = cnt;
			dfs(vvi[cur][j], cur, initial, cntL);
		}
	}
}

int main() {
	#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
    freopen("o.txt", "w", stdout);
    #endif
	int a;
	cin>>n>>a;
	vector<int> vi;
	FOR(i, n) vvi.push_back(vi);
	while(a--) {
		int from, to;
		cin>>from>>to;
		--from; --to;
		vvi[from].push_back(to);
		vvi[to].push_back(from);
	}
	FOR(i, n) {
		if(!vis[i]) {
			int cnt = 0;
			dfs(i, -1, i, cnt);
		}
	}
	int ans = (n - length)%2?length-1:length;
	cout<<ans;
}


#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
#define FOR(i, n) for(int i=0; i<(int)(n); ++i)

const int N = 100;
int n, length = 0;

vector<vector<int>> vvi;
vector<int> vis(N, 0);
void dfs(int cur, int par, int &initial, int &cnt) {
	if(cur == initial&&par != -1) {
		if(cnt%2) length++;
	}
	if(vis[cur]) return;
	vis[cur] = 1;
	++cnt;
	if (vvi[cur].size()==1) {
		if(par = -1) {
			dfs(vvi[cur][0], cur, initial, cnt);
		} else {
			if(cnt%2) length++;
		}
	} else if (vvi[cur].size()==2) {
		FOR(j, vvi[cur].size()) if(vvi[cur][j] != par) {
			dfs(vvi[cur][j], cur, initial, cnt);
		}
	}
}

int main() {
	#ifndef ONLINE_JUDGE
    freopen("i.txt", "r", stdin);
    freopen("o.txt", "w", stdout);
    #endif
	int a;
	cin>>n>>a;
	vector<int> vi;
	FOR(i, n) vvi.push_back(vi);
	while(a--) {
		int from, to;
		cin>>from>>to;
		--from; --to;
		vvi[from].push_back(to);
		vvi[to].push_back(from);
	}
	FOR(i, n) {
		if(!vis[i]) {
			int cnt = 0;
			dfs(i, -1, i, cnt);
		}
	}
	int ans = (n - length)%2?length+1:length;
	cout<<ans;
}


//
//  main.cpp
//  IOI Goals
//
//  Created by Nishant Dhankhar on 25/07/18.
//  Copyright © 2018 Nishant Dhankhar. All rights reserved.
//

#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#include <iostream>
//#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=k;i<n;i++)
//#define size() strlen()
#define REV(x) reverse(x.begin(),x.end())
//#define ll %l64d
#define co 100005;
using namespace std;
#define fori(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define SORT(x) sort(x.begin(),x.end())
//vector<int> num;
#define pb push_back
//int compi(char a,char b)
using namespace std;
#define ll long long
vector<int> adj[102];
bool vis[100];
bool color[100];
//int sum;

int main(){
    //sum=0;
    int n,m;
    cin>>n>>m;
    int sum;
    //vector<int> adj[n];
    sum=0;
    int a,b;
    for(int i=0;i<m;i++){
        cin>>a>>b; if(vis[a]&&vis[b]){
            if((color[a]&&color[b])||(!color[a]&&color[b])) sum++;
        }
        else if(vis[a]){
            color[b]=!color[a];
        }
        else if(vis[b]){
            color[a]=!color[b];
        }
        else {
            color[a]=1;
            color[b]=0;
        }
        vis[a]=true;
        vis[b]=true;
    }
    //int sum;
    if((n-sum)%2==1) sum++;//earlier forgot to check that a team cannot be formed by odd number of players
    cout<<sum<<endl;
    return 0;
}


//
//  main.cpp
//  IOI Goals
//
//  Created by Nishant Dhankhar on 25/07/18.
//  Copyright © 2018 Nishant Dhankhar. All rights reserved.
//

#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#include <iostream>
//#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=k;i<n;i++)
//#define size() strlen()
#define REV(x) reverse(x.begin(),x.end())
//#define ll %l64d
#define co 100005;
using namespace std;
#define fori(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define SORT(x) sort(x.begin(),x.end())
//vector<int> num;
#define pb push_back
//int compi(char a,char b)
using namespace std;
#define ll long long
vector<int> adj[102];
bool vis[100];
bool color[100];
//int sum;

int main(){
    //sum=0;
    int n,m;
    cin>>n>>m;
    int sum;
    //vector<int> adj[n];
    sum=0;
    int a,b;
    for(int i=0;i<m;i++){
        cin>>a>>b; if(vis[a]&&vis[b]){
            if((color[a]&&color[b])||(!color[a]&&color[b])) sum++;
        }
        else if(vis[a]){
            color[b]=!color[a];
        }
        else if(vis[b]){
            color[a]=!color[b];
        }
        else {
            color[a]=1;
            color[b]=0;
        }
        vis[a]=true;
        vis[b]=true;
    }
    //int sum;

    cout<<sum<<endl;
    return 0;
}


//
//  main.cpp
//  IOI Goals
//
//  Created by Nishant Dhankhar on 25/07/18.
//  Copyright © 2018 Nishant Dhankhar. All rights reserved.
//

#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#include <iostream>
//#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=k;i<n;i++)
//#define size() strlen()
#define REV(x) reverse(x.begin(),x.end())
//#define ll %l64d
#define co 100005;
using namespace std;
#define fori(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define SORT(x) sort(x.begin(),x.end())
//vector<int> num;
#define pb push_back
//int compi(char a,char b)
using namespace std;
#define ll long long
vector<int> adj[102];
bool vis[100];
bool color[100];
//int sum;

int main(){
    //sum=0;
    int n,m;
    cin>>n>>m;
    int sum;
    //vector<int> adj[n];
    sum=0;
    int a,b;
    for(int i=0;i<m;i++){
        cin>>a>>b; if(vis[a]&&vis[b]){
            if((color[a]&&color[b])||(!color[a]&&!color[b])) sum++;
        }
        else if(vis[a]){
            color[b]=!color[a];
        }
        else if(vis[b]){
            color[a]=!color[b];
        }
        else {
            color[a]=1;
            color[b]=0;
        }
        vis[a]=true;
        vis[b]=true;
    }
    //int sum;
    if((n-sum)%2==1) sum++;//earlier forgot to check that a team cannot be formed by odd number of players
    cout<<sum<<endl;
    return 0;
}


//
//  main.cpp
//  IOI Goals
//
//  Created by Nishant Dhankhar on 25/07/18.
//  Copyright © 2018 Nishant Dhankhar. All rights reserved.
//

#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#include <iostream>
//#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=k;i<n;i++)
//#define size() strlen()
#define REV(x) reverse(x.begin(),x.end())
//#define ll %l64d
#define co 100005;
using namespace std;
#define fori(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define SORT(x) sort(x.begin(),x.end())
//vector<int> num;
#define pb push_back
//int compi(char a,char b)
using namespace std;
#define ll long long
vector<int> adj[102];
bool vis[120];
int sum;
//sum=0;
bool color[120];
void dfs(int a){
    if(vis[a]) {return;}
    vis[a] = true;
    for(auto x: adj[a]){
        if(!vis[x]) {color[x]=!color[a]; dfs(x);}
        else if(vis[x]) {
            if((color[x]&&color[a])^(!color[x]&&!color[a])) {sum++;} //cout<<a<<" "<<x<<" ";}
        }
    }
    return;
}
int main(){
    int n,m;
    cin>>n>>m;
    sum=0;
    //vector<int> adj[n];

    int a,b;
    for(int i=0;i<m;i++){
        cin>>a>>b; adj[a].pb(b);
        adj[b].pb(a);
    }
    //int sum;
    for(int i=1;i<=n;i++){
        if(!vis[i]){color[i]=true; dfs(i);//cout<<i<<sum<<endl;}
    }
    sum=sum/2;
    if((n-sum)%2==1) sum++;
    cout<<sum<<endl;
    return 0;
}


//
//  main.cpp
//  IOI Goals
//
//  Created by Nishant Dhankhar on 25/07/18.
//  Copyright © 2018 Nishant Dhankhar. All rights reserved.
//

#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#include <iostream>
//#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=k;i<n;i++)
//#define size() strlen()
#define REV(x) reverse(x.begin(),x.end())
//#define ll %l64d
#define co 100005;
using namespace std;
#define fori(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define SORT(x) sort(x.begin(),x.end())
//vector<int> num;
#define pb push_back
//int compi(char a,char b)
using namespace std;
#define ll long long
vector<int> adj[102];
bool vis[120];
int sum;
//sum=0;
bool color[120];
void dfs(int a){
    if(vis[a]) {return;}
    vis[a] = true;
    for(auto x: adj[a]){
        if(!vis[x]) {color[x]=!color[a]; dfs(x);}
        else if(vis[x]) {
            if((color[x]&&color[a])^(!color[x]&&!color[a])) sum++; //cout<<a<<" "<<x<<" ";}
        }
    }
    return;
}
int main(){
    int n,m;
    cin>>n>>m;
    sum=0;
    //vector<int> adj[n];

    int a,b;
    for(int i=0;i<m;i++){
        cin>>a>>b; adj[a].pb(b);
        adj[b].pb(a);
    }
    //int sum;
    for(int i=1;i<=n;i++){
        if(!vis[i]){color[i]=true; dfs(i);}//cout<<i<<sum<<endl;}
    }
    sum=sum/2;
    if((n-sum)%2==1) sum++;
    cout<<sum<<endl;
    return 0;
}


//
//  main.cpp
//  IOI Goals
//
//  Created by Nishant Dhankhar on 25/07/18.
//  Copyright © 2018 Nishant Dhankhar. All rights reserved.
//

#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#include <iostream>
//#include <bits/stdc++.h>
#define FOR(i,k,n) for(int i=k;i<n;i++)
//#define size() strlen()
#define REV(x) reverse(x.begin(),x.end())
//#define ll %l64d
#define co 100005;
using namespace std;
#define fori(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define SORT(x) sort(x.begin(),x.end())
//vector<int> num;
#define pb push_back
//int compi(char a,char b)
using namespace std;
#define ll long long
vector<int> adj[102];
bool vis[120];
int sum;
//sum=0;
bool color[120];
void dfs(int a){
    if(vis[a]) {return;}
    vis[a] = true;
    for(auto x: adj[a]){
        if(!vis[x]) {color[x]=!color[a]; dfs(x);}
        else if(vis[x]) {
            if((color[x]&&color[a])^(!color[x]&&!color[a])) {sum++; cout<<a<<" "<<x<<" ";}
        }
    }
    return;
}
int main(){
    int n,m;
    cin>>n>>m;
    sum=0;
    //vector<int> adj[n];

    int a,b;
    for(int i=0;i<m;i++){
        cin>>a>>b; adj[a].pb(b);
        adj[b].pb(a);
    }
    //int sum;
    for(int i=1;i<=n;i++){
        if(!vis[i]){color[i]=true; dfs(i);cout<<i<<sum<<endl;}
    }
    sum=sum/2;
    if((n-sum)%2==1) sum++;
    cout<<sum<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dcm(a) setprecision(a)<<fixed
#define MOD 1000000007
#define clr(memo, a) memset(memo,a,sizeof(memo))
#define PI acos(-1)
#define pb push_back
int const N=1e2+5;
vector <int> adj[N];
int start[N];
int finsh [N];
int timer=1;
int ans=0;
void dfs (int v){
    start[v]=timer++;
    for(auto u :adj[v]){
        if(!start[u])
            dfs(u);
        else
            if(start[v]<start[u]&start[u]-start[v]<=2)
            ans++;
    }
    finsh[v]=timer++;
}
int main () {
int n,m;
cin>>n>>m;
for(int i=0;i<m;i++){
    int x,y;
    cin>>x>>y;
    adj[x].push_back(y);
    adj[y].push_back(x);
}
for(int i=1;i<=n;i++)
    dfs(i);
n-=ans;
if(n&1)
    cout<<ans+1<<endl;
else
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dcm(a) setprecision(a)<<fixed
#define MOD 1000000007
#define clr(memo, a) memset(memo,a,sizeof(memo))
#define PI acos(-1)
#define pb push_back
int const N=1e2+5;
vector <int> adj[N];
int start[N];
int finsh [N];
int timer=1;
int ans=0;
void dfs (int v){
    start[v]=timer++;
    for(auto u :adj[v]){
        if(!start[u])
            dfs(u);
        else
            if(!finsh[u])
            ans++;
            if(start[v]<start[u]&start[u]-start[v]<=2)
            ans++;
    }
    finsh[v]=timer++;
}
int main () {
int n,m;
cin>>n>>m;
for(int i=0;i<m;i++){
    int x,y;
    cin>>x>>y;
    adj[x].push_back(y);
    adj[y].push_back(x);
}
for(int i=1;i<=n;i++)
    dfs(i);
n-=ans;
if(n&1)
    cout<<ans+1<<endl;
else
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dcm(a) setprecision(a)<<fixed
#define MOD 1000000007
#define clr(memo, a) memset(memo,a,sizeof(memo))
#define PI acos(-1)
#define pb push_back
int const N=1e2+5;
vector <int> adj[N];
int start[N];
int finsh [N];
int timer=1;
int ans=0;
void dfs (int v){
    start[v]=timer++;
    for(auto u :adj[v]){
        if(!start[u])
            dfs(u);
        else
            if(start[v]<start[u])
            ans++;
    }
    finsh[v]=timer++;
}
int main () {
int n,m;
cin>>n>>m;
for(int i=0;i<m;i++){
    int x,y;
    cin>>x>>y;
    adj[x].push_back(y);
    adj[y].push_back(x);
}
for(int i=1;i<=n;i++)
    dfs(i);
n-=ans;
if(n&1)
    cout<<ans+1<<endl;
else
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dcm(a) setprecision(a)<<fixed
#define MOD 1000000007
#define clr(memo, a) memset(memo,a,sizeof(memo))
#define PI acos(-1)
#define pb push_back
int const N=1e2+5;
vector <int> adj[N];
int start[N];
int finsh [N];
int timer=1;
int ans=0;
void dfs (int v){
    start[v]=timer++;
    for(auto u :adj[v]){
        if(!start[u])
            dfs(u);
        else
            if(start[v]<start[u])
            ans++;
    }
    finsh[v]=timer++;
}
int main () {
int n,m;
cin>>n>>m;
for(int i=0;i<m;i++){
    int x,y;
    cin>>x>>y;
    adj[x].push_back(y);
    adj[y].push_back(x);
}
for(int i=1;i<=n;i++)
    dfs(i);
cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define dcm(a) setprecision(a)<<fixed
#define MOD 1000000007
#define clr(memo, a) memset(memo,a,sizeof(memo))
#define PI acos(-1)
#define pb push_back
int const N=1e2+5;
vector <int> adj[N];
int vis[N];
int dfs (int v,int p,int &cnt){
    if(vis[v])
        return 1;
    vis[v]=1;
    for(auto u :adj[v])if(u!=p)
        {
        ++cnt;
    if(dfs(u,v,cnt))
    return 1;
    }
    return 0;
}
int main () {
int n,m;
cin>>n>>m;
for(int i=0;i<m;i++){
    int x,y;
    cin>>x>>y;
    adj[x].push_back(y);
    adj[y].push_back(x);
}
int ans=0;
for(int i=1;i<=n;i++)
    if(!vis[i]){
        int cnt=0;
   int so= dfs(i,-1,cnt);
    if(so==1&&cnt&1)
        ans++;
    }
n-=ans;
if(n&1)
    cout<<ans+1<<endl;
else
    cout<<ans<<endl;
}


#include <bits/stdc++.h>

#define vpii vector< pair<int,int> >
#define vi vector<int>

#define for0(i,a) for(int i=0;i<a;i++)
#define pii              pair <int,int>
#define pll              pair <long long,long long>
#define sc               scanf
#define pf               printf
#define Pi               2*acos(0.0)
#define ms(a,b)          memset(a, b, sizeof(a))
#define pb(a)            push_back(a)
#define MP               make_pair
#define db               double
#define ll               long long
#define ull              unsigned long long
#define f                first
#define s                second
#define sqr(x)           (x)*(x)
#define VI               vector <int>
#define DBG              pf("Hi\n")
#define MOD              1000000007
#define SZ(a)            (int)a.size()
#define sf(a)            scanf("%d",&a)
#define sfl(a)           scanf("%lld",&a)
#define sff(a,b)         scanf("%d %d",&a,&b)
#define sffl(a,b)        scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)
#define loop(i,n)        for(int i=0;i<n;i++)
#define loop1(i,n)       for(int i=1;i<=n;i++)
#define REP(i,a,b)       for(int i=a;i<b;i++)
#define RREP(i,a,b)      for(int i=a;i>=b;i--)
#define intlim           2147483648
#define ull              unsigned long long
#define gcd(a, b)        __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b)))
#define mk(x1,y1) make_pair(x1, y1)
#define maxl 1000000
#define psz 20
#define Fin      freopen("input.txt","r",stdin)
#define Fout     freopen("output.txt","w",stdout)
using namespace std;

/*----------------------Graph Moves----------------*/
const int fx[]={+1,-1,+0,+0};
const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N | (1<<pos);}
//int reset(int N,int pos){return N= N & ~(1<<pos);}
//bool check(int N,int pos){return (bool)(N & (1<<pos));}
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
//ios_base::sync_with_stdio(false);
 //cin.tie(NULL);
vector<int>g[1000];

bool sign[1000];
int col[1000];

int BFS(int u){
    int now = 0;
    sign[u] = false;
    col[u] = 0;

    queue< pair<int, int> >q;
    q.push( mk(u,0) );

    while(!q.empty()){
        int u = q.front().first;
        int cl = q.front().second;
        q.pop();

        for(auto v : g[u]){
            if(sign[v]){
                sign[v] = false;
                if(cl == 0) col[v] = 1;
                else col[v] = 0;
                q.push( mk(v,col[v]) );
            }
            if(col[v] == col[u]) return now = 1;
       }

    }
   // cout<<"U  "<<u<<"  "<<now<<endl;
    return now;
}

int main(){

   int n,m;
   scanf("%d%d",&n,&m);
   int x,y;
   int ans = 0;
   for(int i = 1; i <=n; i++) sign[i] = true, col[i] = -1;
   for(int i = 0; i < m; i++){
        scanf("%d%d",&x,&y);
        g[x].pb(y);
        g[y].pb(x);
   }

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

      if(sign[i]){
        ans += BFS(i);
      }
   }

   int tot = n - ans;
   if(tot%2) ans++;
   cout << ans << endl;
   return 0;
}


#include<iostream>
#include<string>
#include<stack>
#include<queue>
//#include<bits/stdc++.h>
using namespace std;

int root[1000],sz1[1000],sz2[1000];

int Root(int i){

    while(i != root[i]) i = root[root[i]];
    return i;
}
int Transfer(int x, int y){
    int r1 = Root(x);
    int r2 = Root(y);

    if(r1 == r2) return 1;
    if(sz1[r1] > sz2[r2]){
        sz1[r1] += sz2[r2];
        root[r2] = r1;
    }
    else{
        sz2[r2] += sz1[r1];
        root[r1] = r2;
    }
    return 0;
}

int main(){

   int n,m;
   scanf("%d%d",&n,&m);
   int a[n + 5],b[n + 5];
   root[0] = -1;
   int ans = 0;
   for(int i = 1; i <=n; i++) root[i] = i, sz1[i] = 0, sz2[i] = 0;
   for(int i = 0; i < m; i++){
        scanf("%d%d",&a[i],&b[i]);
        ans += Transfer(a[i],b[i]);
   }
   if( (n-ans) % 2 ) ans++;
   printf("%d\n",ans);
   return 0;
}


#include <bits/stdc++.h>

#define vpii vector< pair<int,int> >
#define vi vector<int>

#define for0(i,a) for(int i=0;i<a;i++)
#define pii              pair <int,int>
#define pll              pair <long long,long long>
#define sc               scanf
#define pf               printf
#define Pi               2*acos(0.0)
#define ms(a,b)          memset(a, b, sizeof(a))
#define pb(a)            push_back(a)
#define MP               make_pair
#define db               double
#define ll               long long
#define ull              unsigned long long
#define f                first
#define s                second
#define sqr(x)           (x)*(x)
#define VI               vector <int>
#define DBG              pf("Hi\n")
#define MOD              1000000007
#define SZ(a)            (int)a.size()
#define sf(a)            scanf("%d",&a)
#define sfl(a)           scanf("%lld",&a)
#define sff(a,b)         scanf("%d %d",&a,&b)
#define sffl(a,b)        scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)
#define loop(i,n)        for(int i=0;i<n;i++)
#define loop1(i,n)       for(int i=1;i<=n;i++)
#define REP(i,a,b)       for(int i=a;i<b;i++)
#define RREP(i,a,b)      for(int i=a;i>=b;i--)
#define intlim           2147483648
#define ull              unsigned long long
#define gcd(a, b)        __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b)))
#define mk(x1,y1) make_pair(x1, y1)
#define maxl 1000000
#define psz 20
#define Fin      freopen("input.txt","r",stdin)
#define Fout     freopen("output.txt","w",stdout)
using namespace std;

/*----------------------Graph Moves----------------*/
const int fx[]={+1,-1,+0,+0};
const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};   // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};  // Kings Move
//const int fx[]={-2, -2, -1, -1,  1,  1,  2,  2};  // Knights Move
//const int fy[]={-1,  1, -2,  2, -2,  2, -1,  1}; // Knights Move
/*------------------------------------------------*/

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N | (1<<pos);}
//int reset(int N,int pos){return N= N & ~(1<<pos);}
//bool check(int N,int pos){return (bool)(N & (1<<pos));}
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
//ios_base::sync_with_stdio(false);
 //cin.tie(NULL);
vector<int>g[1000];

bool sign[1000];
int col[1000];

int BFS(int u){
    int now = 0;
    sign[u] = false;
    col[u] = 0;

    queue< pair<int, int> >q;
    q.push( mk(u,0) );

    while(!q.empty()){
        int u = q.front().first;
        int cl = q.front().second;
        q.pop();

        for(auto v : g[u]){
            if(sign[v]){
                sign[v] = false;
                if(cl == 0) col[v] = 1;
                else col[v] = 0;
                q.push( mk(v,col[v]) );
            }
            if(col[v] == col[u]) now = 1;
       }

    }
   // cout<<"U  "<<u<<"  "<<now<<endl;
    return now;
}

int main(){

   int n,m;
   scanf("%d%d",&n,&m);
   int x,y;
   int ans = 0;
   for(int i = 1; i <=n; i++) sign[i] = true, col[i] = -1;
   for(int i = 0; i < m; i++){
        scanf("%d%d",&x,&y);
        g[x].pb(y);
        g[y].pb(x);
   }

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

      if(sign[i]){
        ans += BFS(i);
      }
   }

   int tot = n - ans;
   if(tot%2) ans++;
   cout << ans << endl;
   return 0;
}


#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<bits/stdc++.h>
using namespace std;

int main(){

   int n,m;
   scanf("%d%d",&n,&m);
   int a[n + 5],b[n + 5];
   //root[0] = -1;
   bool sign1[n + 3], sign2[n + 3];
   memset(sign1, true, sizeof sign1);
   memset(sign2, true, sizeof sign2);
   int ans = 0;

   for(int i = 0; i < m; i++){
        scanf("%d%d",&a[i],&b[i]);

        if( (!sign1[a[i]] && !sign1[b[i]] ) || (!sign2[a[i]] && !sign2[b[i]] ) ) ans++;
        else if(!sign1[a[i]]){
        	sign2[b[i]] = false;
        	//cout<<"I.  "<<i<<endl;
        }
        else if(!sign1[b[i]]){
        	sign2[a[i]] = false;
        	//	cout<<"I1  "<<i<<endl;
        }
         else if(!sign2[a[i]]){
        	sign1[b[i]] = false;
        	//cout<<"I.  "<<i<<endl;
        }
        else if(!sign2[b[i]]){
        	sign1[a[i]] = false;
        	//	cout<<"I1  "<<i<<endl;
        }
        else{
        	sign1[a[i]] = sign2[b[i]] = false;
        	//	cout<<"I2  "<<i<<endl;
        }
       // ans += Transfer(a[i],b[i]);
   }
   if( (n-ans) % 2 ) ans++;
   printf("%d\n",ans);
   return 0;
}


#include<bits/stdc++.h>
using namespace std;

int root[1000],sz1[1000],sz2[1000];

int Root(int i){

    while(i != root[i]) i = root[root[i]];
    return i;
}
int Transfer(int x, int y){
    int r1 = Root(x);
    int r2 = Root(y);

    if(r1 == r2) return 1;
    if(sz1[r1] > sz2[r2]){
        sz1[r1] += sz2[r2];
        root[r2] = r1;
    }
    else{
        sz2[r2] += sz1[r1];
        root[r1] = r2;
    }
    return 0;
}

int main(){

   int n,m;
   scanf("%d%d",&n,&m);
   int a[n + 5],b[n + 5];
   root[0] = -1;
   int ans = 0;
   for(int i = 1; i <=n; i++) root[i] = i, sz1[i] = 0, sz2[i] = 0;
   for(int i = 0; i < m; i++){
        scanf("%d%d",&a[i],&b[i]);
        ans += Transfer(a[i],b[i]);
   }
   printf("%d\n",ans);
   return 0;
}


#include<iostream>
#include<string>
#include<stack>
#include<queue>
//#include<bits/stdc++.h>
using namespace std;

int main(){

   int n,m;
   scanf("%d%d",&n,&m);
   int a[n + 5],b[n + 5];
   //root[0] = -1;
   bool sign1[n + 3], sign2[n + 3];
   memset(sign1, true, sizeof sign1);
   memset(sign2, true, sizeof sign2);
   int ans = 0;

   for(int i = 0; i < m; i++){
        scanf("%d%d",&a[i],&b[i]);

        if( (!sign1[a[i]] && !sign1[b[i]] ) || (!sign2[a[i]] && !sign2[b[i]] ) ) ans++;
        else if(!sign1[a[i]]){
        	sign2[b[i]] = false;
        	//cout<<"I.  "<<i<<endl;
        }
        else if(!sign1[b[i]]){
        	sign2[a[i]] = false;
        	//	cout<<"I1  "<<i<<endl;
        }
         else if(!sign2[a[i]]){
        	sign1[b[i]] = false;
        	//cout<<"I.  "<<i<<endl;
        }
        else if(!sign2[b[i]]){
        	sign1[a[i]] = false;
        	//	cout<<"I1  "<<i<<endl;
        }
        else{
        	sign1[a[i]] = sign2[b[i]] = false;
        	//	cout<<"I2  "<<i<<endl;
        }
       // ans += Transfer(a[i],b[i]);
   }
   if( (n-ans) % 2 ) ans++;
   printf("%d\n",ans);
   return 0;
}


#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <deque>

#define  all(v)         ((v).begine()),((v).end())
#define  sz(v)	        ((int)(v).size())
#define	 clr(v,d)       memset(v,d,sizeof(v))
#define  lp(i,n)        for(int i=0; i<n; i++)
#define  lpi(i,j,n)     for(int i=j; i<n; i++)
#define  lpd(i,j,n)     for(int i=j; i>=n; i--)
const double E = 1e-12;

typedef  long long ll;
typedef  long double ld;
/*typedef  vector<int> vi;
typedef  vector<char> vc;
typedef  vector<string> vs;
typedef  vector<bool> vb();
*/
using namespace std;

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}
int m, n;
vector< vector<int> >adj;
vector<int> vis;
int sum = 0;
void dfs(int ind,int num,int last){
	if (vis[ind]==1)
	{

		if (ind == num)
		{
			vis[ind] = -1;
			sum++;
		}
		return;
	}
	if (vis[ind] == -1)
		return;
	vis[ind] = 1;
	lp(i, adj[ind].size())
	if (last!=adj[ind][i])
		dfs(adj[ind][i],num,ind);

}
int main()
{
	fast();
	cin >> n >> m;
	adj = vector< vector<int> >(n);
	vis = vector<int>(n, 0);
	lp(i, m)
	{
		int a, s;
		cin >> a >> s;
		a--;
		s--;
		adj[a].push_back(s);
		adj[s].push_back(a);
	}
	lp(i, n)
	if (vis[i] == 0){
		dfs(i, i,i);
	}

	cout << sum ;
//	system("pause");
	return 0;
}


#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <deque>

#define  all(v)         ((v).begine()),((v).end())
#define  sz(v)	        ((int)(v).size())
#define	 clr(v,d)       memset(v,d,sizeof(v))
#define  lp(i,n)        for(int i=0; i<n; i++)
#define  lpi(i,j,n)     for(int i=j; i<n; i++)
#define  lpd(i,j,n)     for(int i=j; i>=n; i--)
const double E = 1e-12;

typedef  long long ll;
typedef  long double ld;
/*typedef  vector<int> vi;
typedef  vector<char> vc;
typedef  vector<string> vs;
typedef  vector<bool> vb();
*/
using namespace std;

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}
int m, n;
vector< vector<int> >adj;
vector<int> vis;
int sum = 0;
void dfs(int ind,int num,int last){
	if (vis[ind]==1)
	{

		if (ind == num)
		{
			vis[ind] = -1;
			sum++;
		}
		return;
	}
	if (vis[ind] == -1)
		return;
	vis[ind] = 1;
	lp(i, adj[ind].size())
	if (last!=adj[ind][i])
		dfs(adj[ind][i],num,ind);

}
int main()
{
	fast();
	cin >> n >> m;
	adj = vector< vector<int> >(n);
	vis = vector<int>(n, 0);
	lp(i, m)
	{
		int a, s;
		cin >> a >> s;
		a--;
		s--;
		adj[a].push_back(s);
		adj[s].push_back(a);
	}
	lp(i, n)
	if (vis[i] == 0){
		dfs(i, i,i);
	}
	if ((n - sum) % 2)
		cout << sum + 1;
	else
	cout << sum ;
//	system("pause");
	return 0;
}


#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <deque>

#define  all(v)         ((v).begine()),((v).end())
#define  sz(v)	        ((int)(v).size())
#define	 clr(v,d)       memset(v,d,sizeof(v))
#define  lp(i,n)        for(int i=0; i<n; i++)
#define  lpi(i,j,n)     for(int i=j; i<n; i++)
#define  lpd(i,j,n)     for(int i=j; i>=n; i--)
const double E = 1e-12;

typedef  long long ll;
typedef  long double ld;
/*typedef  vector<int> vi;
typedef  vector<char> vc;
typedef  vector<string> vs;
typedef  vector<bool> vb();
*/
using namespace std;

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}
int m, n;
vector< vector<int> >adj;
vector<int> vis;
int sum = 0;
void dfs(int ind,int last,int num){
	//cout << ind+1 << " " << last +1<< " " << num << endl;
	if (vis[ind]==1)
	{
		//cout << num << endl;
		if (adj[ind].size() == 2&&num%2)
			sum++;
			return ;
	}
	vis[ind] = 1;
	lp(i, adj[ind].size())
	if (adj[ind][i]!=last)
		return dfs(adj[ind][i],ind,num+1);
}
int main()
{
	fast();
	cin >> n >> m;
	adj = vector< vector<int> >(n);
	vis = vector<int>(n, 0);
	lp(i, m)
	{
		int a, s;
		cin >> a >> s;
		a--;
		s--;
		adj[a].push_back(s);
		adj[s].push_back(a);
	}
	lp(i, n)
	if (vis[i] == 0){
		dfs(i, i,0);
	}
	if ((n - sum) % 2)
		cout << sum + 1;
	else
	cout << sum ;
//	system("pause");
	return 0;
}


#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <deque>

#define  all(v)         ((v).begine()),((v).end())
#define  sz(v)	        ((int)(v).size())
#define	 clr(v,d)       memset(v,d,sizeof(v))
#define  lp(i,n)        for(int i=0; i<n; i++)
#define  lpi(i,j,n)     for(int i=j; i<n; i++)
#define  lpd(i,j,n)     for(int i=j; i>=n; i--)
const double E = 1e-12;

typedef  long long ll;
typedef  long double ld;
/*typedef  vector<int> vi;
typedef  vector<char> vc;
typedef  vector<string> vs;
typedef  vector<bool> vb();
*/
using namespace std;

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}
int m, n;
vector< vector<int> >adj;
vector<int> vis;
int sum = 0;
void dfs(int ind, int last, int num, int par){
	//cout << ind+1 << " " << last +1<< " " << num << endl;
	if (vis[ind] == 1)
	{
		//cout << num << endl;
		if (adj[ind].size() == 2 && num % 2&&ind ==par)
			sum++;
		return;
	}
	vis[ind] = 1;
	lp(i, adj[ind].size())
	if (adj[ind][i] != last)
		return dfs(adj[ind][i], ind, num + 1,par);
}
int main()
{
	fast();
	cin >> n >> m;
	adj = vector< vector<int> >(n);
	vis = vector<int>(n, 0);
	lp(i, m)
	{
		int a, s;
		cin >> a >> s;
		a--;
		s--;
		adj[a].push_back(s);
		adj[s].push_back(a);
	}
	lp(i, n)
	if (vis[i] == 0){
		dfs(i, i, 0,i);
	}
	if ((n - sum) % 2)
		cout << sum + 1;
	else
		cout << sum;
		system("pause");
	return 0;
}


#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <deque>

#define  all(v)         ((v).begine()),((v).end())
#define  sz(v)	        ((int)(v).size())
#define	 clr(v,d)       memset(v,d,sizeof(v))
#define  lp(i,n)        for(int i=0; i<n; i++)
#define  lpi(i,j,n)     for(int i=j; i<n; i++)
#define  lpd(i,j,n)     for(int i=j; i>=n; i--)
const double E = 1e-12;

typedef  long long ll;
typedef  long double ld;
/*typedef  vector<int> vi;
typedef  vector<char> vc;
typedef  vector<string> vs;
typedef  vector<bool> vb();
*/
using namespace std;

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}
int m, n;
vector< vector<int> >adj;
vector<int> vis;
int sum = 0;
void dfs(int ind, int last, int num, int par){
	//cout << ind+1 << " " << last +1<< " " << num << endl;
	if (vis[ind] == 1)
	{
		//cout << num << endl;
		if (adj[ind].size() == 2 && num % 2&&ind ==par)
			sum++;
		return;
	}
	vis[ind] = 1;
	lp(i, adj[ind].size())
	if (adj[ind][i] != last)
		return dfs(adj[ind][i], ind, num + 1,par);
}
int main()
{
	fast();
	cin >> n >> m;
	adj = vector< vector<int> >(n);
	vis = vector<int>(n, 0);
	lp(i, m)
	{
		int a, s;
		cin >> a >> s;
		a--;
		s--;
		adj[a].push_back(s);
		adj[s].push_back(a);
	}
	lp(i, n)
	if (vis[i] == 0){
		dfs(i, i, 0,i);
	}
	if ((n - sum) % 2)
		cout << sum + 1;
	else
		cout << sum;
	//	system("pause");
	return 0;
}


#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <queue>
#include <deque>

#define  all(v)         ((v).begine()),((v).end())
#define  sz(v)	        ((int)(v).size())
#define	 clr(v,d)       memset(v,d,sizeof(v))
#define  lp(i,n)        for(int i=0; i<n; i++)
#define  lpi(i,j,n)     for(int i=j; i<n; i++)
#define  lpd(i,j,n)     for(int i=j; i>=n; i--)
const double E = 1e-12;

typedef  long long ll;
typedef  long double ld;
/*typedef  vector<int> vi;
typedef  vector<char> vc;
typedef  vector<string> vs;
typedef  vector<bool> vb();
*/
using namespace std;

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}
int m,n;
vector< vector<int> >adj;
vector<int> vis;
int sum = 0;
void dfs(int ind, int clr){
	if (vis[ind] == clr)
	{
		sum++;
		return;
	}
	if (vis[ind] != -1){
		return;
	}
	vis[ind] = 1 - clr;
	lp(i, adj[ind].size())
		dfs(adj[ind][i],vis[ind]);

}
int main()
{
	fast();
	cin >> n >> m;
	adj = vector< vector<int> >(n);
	vis = vector<int>(n, -1);
	lp(i, m)
	{
		int a, s;
		cin >> a >> s;
		a--;
		s--;
		adj[a].push_back(s);
		adj[s].push_back(a);
	}
	lp(i,n)
	if (vis[i] == -1)
		dfs(i,0);
	cout << sum/2;
//	system("pause");
	return 0;
}


/*
**   Contest : Codeforces Round #133 (Div. 2)
**   Problem : B. Forming Teams
**
**    Author : Dhiraj Govindvira
**      Date : 08-Jun-2020 ~ Monday
**      Time : 08:45:44 PM
*/

#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename T>
inline void inp(T &any) {
    cin >> any;
}
template <typename T, typename... U>
inline void inp(T &a, U &...b) {
    cin >> a; inp(b...);
}
// scan vector
template <typename T>
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U>
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second;
    return in;
}

// Solve --------------------------------------------------------------------

using graph = vector<vector<ll>>;

void solve(ll &T)
{
    ll n, m;
    cin>>n>>m;

    graph g(n+1);
    loop(i,0,m)
    {
        ll x, y;
        cin>>x>>y;
        g[x].emplace_back(y);
        g[y].emplace_back(x);
    }

    vector<bool> vis(n+1);

    ll ans = 0;
    loop(i,1,n+1)
    {
        if(!vis[i] and g[i].size() == 2 and g[g[i][1]].size() == 2 and g[g[i][1]].size() == 2)
        {
            ans++;
            vis[i] = vis[g[i][0]] = vis[g[i][1]] = true;
        }
    }
    ll cnt = count(all(vis),false) - 1;
    ans += (cnt & 1);

    cout<<ans<<endl;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    loop(Case,1,t+1)
    {
        cerr<<"Case #"<<Case<<"\n";
        solve(Case);
    }
    return 0;
}


/*
**   Contest : Codeforces Round #133 (Div. 2)
**   Problem : B. Forming Teams
**
**    Author : Dhiraj Govindvira
**      Date : 08-Jun-2020 ~ Monday
**      Time : 10:12:25 PM
*/

#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename T>
inline void inp(T &any) {
    cin >> any;
}
template <typename T, typename... U>
inline void inp(T &a, U &...b) {
    cin >> a; inp(b...);
}
// scan vector
template <typename T>
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U>
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second;
    return in;
}

// Solve --------------------------------------------------------------------

using graph = vector<vector<ll>>;
void solve(ll &T)
{
    ll n, m;
    cin>>n>>m;

    graph g(n+1);
    loop(i,0,m)
    {
        ll x, y;
        cin>>x>>y;
        g[x].emplace_back(y);
        g[y].emplace_back(x);
    }

    ll ans = 0;
    loop(i,1,n+1)
    {
        if(g[i].size() == 2)
        {
            vector<ll> s1, s2;
            s1.push_back(i);
            s1.push_back(i);
            s1.push_back(g[i][0]);
            s1.push_back(g[i][1]);

            for(ll adj : g[g[i][0]]) {
                s2.push_back(adj);
            }
            for(ll adj : g[g[i][1]]) {
                s2.push_back(adj);
            }

            sort(all(s1));
            sort(all(s2));
            ans += (s1 == s2);
        }
    }
    ans /= 3;
    ans += ((n - ans) & 1);
    cout<<ans<<endl;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    loop(Case,1,t+1)
    {
        cerr<<"Case #"<<Case<<"\n";
        solve(Case);
    }
    return 0;
}


/*
**   Contest : Codeforces Round #133 (Div. 2)
**   Problem : B. Forming Teams
**
**    Author : Dhiraj Govindvira
**      Date : 08-Jun-2020 ~ Monday
**      Time : 10:12:25 PM
*/

#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename T>
inline void inp(T &any) {
    cin >> any;
}
template <typename T, typename... U>
inline void inp(T &a, U &...b) {
    cin >> a; inp(b...);
}
// scan vector
template <typename T>
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U>
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second;
    return in;
}

// Solve --------------------------------------------------------------------

using graph = vector<vector<ll>>;
void solve(ll &T)
{
    ll n, m;
    cin>>n>>m;

    graph g(n+1);
    loop(i,0,m)
    {
        ll x, y;
        cin>>x>>y;
        g[x].emplace_back(y);
        g[y].emplace_back(x);
    }

    ll ans = 0;
    loop(i,1,n+1)
    {
        if(g[i].size() == 2)
        {
            set<ll> s1, s2;
            s1.insert(i);
            s1.insert(g[i][0]);
            s1.insert(g[i][1]);

            for(ll adj : g[g[i][0]]) {
                s2.insert(adj);
            }
            for(ll adj : g[g[i][1]]) {
                s2.insert(adj);
            }

            auto it1 = s1.begin();
            auto it2 = s2.begin();
            if(s1.size() == s2.size())
            {
                while(it1 != s1.end())
                {
                    if(*it1 != *it2) break;
                    it1++;
                    it2++;
                }
                ans += (it1 == s1.end());
            }
        }
    }
    ans /= 3;
    ans += ((n - ans) & 1);
    cout<<ans<<endl;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    loop(Case,1,t+1)
    {
        cerr<<"Case #"<<Case<<"\n";
        solve(Case);
    }
    return 0;
}


/*
**   Contest : Codeforces Round #133 (Div. 2)
**   Problem : B. Forming Teams
**
**    Author : Dhiraj Govindvira
**      Date : 08-Jun-2020 ~ Monday
**      Time : 08:45:44 PM
*/

#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename T>
inline void inp(T &any) {
    cin >> any;
}
template <typename T, typename... U>
inline void inp(T &a, U &...b) {
    cin >> a; inp(b...);
}
// scan vector
template <typename T>
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U>
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second;
    return in;
}

// Solve --------------------------------------------------------------------

using graph = vector<vector<ll>>;

void solve(ll &T)
{
    ll n, m;
    cin>>n>>m;

    map<ll,bool> t1, t2;
    ll ans = 0;

    vector<bool> vis(n+1);
    loop(i,0,m)
    {
        ll x, y;
        cin>>x>>y;
        if((t1[x] and t1[y]) or (t2[x] and t2[y])) {
            ans++;
        }
        else
        {
            if(t1[x]) t2[y] = true;
            else if(t2[x]) t1[y] = true;
            else if(t1[y]) t2[x] = true;
            else if(t2[y]) t1[x] = true;
            else t1[x] = t2[y] = true;
        }
        vis[x] = vis[y] = true;
    }
    if(n % 2 != ans % 2) ans++;
    cout<<ans<<endl;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    loop(Case,1,t+1)
    {
        cerr<<"Case #"<<Case<<"\n";
        solve(Case);
    }
    return 0;
}


/*
**   Contest : Codeforces Round #133 (Div. 2)
**   Problem : B. Forming Teams
**
**    Author : Dhiraj Govindvira
**      Date : 08-Jun-2020 ~ Monday
**      Time : 10:12:25 PM
*/

#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename T>
inline void inp(T &any) {
    cin >> any;
}
template <typename T, typename... U>
inline void inp(T &a, U &...b) {
    cin >> a; inp(b...);
}
// scan vector
template <typename T>
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U>
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second;
    return in;
}

// Solve --------------------------------------------------------------------

using graph = vector<vector<ll>>;
void solve(ll &T)
{
    ll n, m;
    cin>>n>>m;

    graph g(n+1);
    loop(i,0,m)
    {
        ll x, y;
        cin>>x>>y;
        g[x].emplace_back(y);
        g[y].emplace_back(x);
    }

    ll ans = 0;
    loop(i,1,n+1)
    {
        if(g[i].size() == 2)
        {
            set<ll> s1, s2;

            s1.insert(i);
            s1.insert(g[i][0]);
            s1.insert(g[i][1]);

            for(ll adj : g[g[i][0]]) {
                s2.insert(adj);
            }
            for(ll adj : g[g[i][1]]) {
                s2.insert(adj);
            }
            d(s1, s2);
            ans += (s1 == s2);
        }
    }
    ans /= 3;
    ans += ((n - ans) & 1);
    cout<<ans<<endl;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    loop(Case,1,t+1)
    {
        cerr<<"Case #"<<Case<<"\n";
        solve(Case);
    }
    return 0;
}


/*
**   Contest : Codeforces Round #133 (Div. 2)
**   Problem : B. Forming Teams
**
**    Author : Dhiraj Govindvira
**      Date : 08-Jun-2020 ~ Monday
**      Time : 08:45:44 PM
*/

#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename T>
inline void inp(T &any) {
    cin >> any;
}
template <typename T, typename... U>
inline void inp(T &a, U &...b) {
    cin >> a; inp(b...);
}
// scan vector
template <typename T>
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U>
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second;
    return in;
}

// Solve --------------------------------------------------------------------

using graph = vector<vector<ll>>;

void solve(ll &T)
{
    ll n, m;
    cin>>n>>m;

    graph g(n+1);
    loop(i,0,m)
    {
        ll x, y;
        cin>>x>>y;
        g[x].emplace_back(y);
        g[y].emplace_back(x);
    }

    vector<bool> vis(n+1);

    ll ans = 0;
    loop(i,1,n+1)
    {
        if(!vis[i] and g[i].size() == 2 and g[g[i][1]].size() == 2 and g[g[i][1]].size() == 2)
        {
            ans++;
            vis[g[i][0]] = vis[g[i][1]] = true;
        }
    }
    cout<<ans<<endl;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    loop(Case,1,t+1)
    {
        cerr<<"Case #"<<Case<<"\n";
        solve(Case);
    }
    return 0;
}


#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename T>
inline void inp(T &any) {
    cin >> any;
}
template <typename T, typename... U>
inline void inp(T &a, U &...b) {
    cin >> a; inp(b...);
}
// scan vector
template <typename T>
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U>
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second;
    return in;
}

// Solve --------------------------------------------------------------------

using graph = vector<vector<ll>>;
void solve(ll &T)
{
    ll n, m;
    cin>>n>>m;

    graph g(n+1);
    loop(i,0,m)
    {
        ll x, y;
        cin>>x>>y;
        g[x].emplace_back(y);
        g[y].emplace_back(x);
    }

    ll ans = 0;
    vector<bool> vis(n+1);
    vector<int> clr(n+1,-1);

    loop(i,1,n+1)
    {
        if(!vis[i])
        {
            clr[i] = vis[i] = true;

            queue<ll> q;
            q.push(i);

            bool yes = true;
            while(!q.empty())
            {
                ll u = q.front();
                q.pop();

                for(ll adj : g[u])
                {
                    if(!vis[adj])
                    {
                        vis[adj] = true;
                        clr[adj] = 1 - clr[u];
                        q.push(adj);
                    }
                    else if(clr[adj] == clr[u])
                    {
                        yes = false;
                        break;
                    }
                }
            }
            d(yes);
            ans += (!yes);
        }
    }
    ans += ((n - ans) & 1);
    cout<<ans<<endl;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    loop(Case,1,t+1)
    {
        cerr<<"Case #"<<Case<<"\n";
        solve(Case);
    }
    return 0;
}


/*
**   Contest : Codeforces Round #133 (Div. 2)
**   Problem : B. Forming Teams
**
**    Author : Dhiraj Govindvira
**      Date : 08-Jun-2020 ~ Monday
**      Time : 08:45:44 PM
*/

#if __has_include("D:/dhiraj/Programming/debug.h")
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define loop(i,s,e)         for(ll i=(s); i<(e); i++)
#define rloop(i,s,e)        for(ll i=(s); i>=(e); i--)
#define iter(it,var)        for(auto it=var.begin(); it!=var.end(); it++)
#define riter(it,var)       for(auto it=var.rbegin(); it!=var.rend(); it++)
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename T>
inline void inp(T &any) {
    cin >> any;
}
template <typename T, typename... U>
inline void inp(T &a, U &...b) {
    cin >> a; inp(b...);
}
// scan vector
template <typename T>
inline istream &operator>>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U>
inline istream &operator>>(istream &in, pair<T,U> &a) {
    in >> a.first >> a.second;
    return in;
}

// Solve --------------------------------------------------------------------

using graph = vector<vector<ll>>;
ll ans;
ll Bipartite(graph &g)
{
    ll n = g.size();
    vector<int> clr(n,-1);
    vector<bool> vis(n);

    ll x = 0;
    loop(i,1,n)
    {
        x += (g[i].size() == 0);

        if(!vis[i])
        {
            vis[i] = true;
            clr[i] = 1;

            queue<ll> q;
            q.push(i);
            while(!q.empty())
            {
                ll u = q.front(); q.pop();
                for(ll &adj : g[u])
                {
                    if(!vis[adj])
                    {
                        vis[adj] = true;
                        clr[adj] = 1 - clr[u];
                        q.push(adj);
                    }
                    else if(clr[adj] == clr[u]) {
                        ans++;
                    }
                }
            }
        }
    }
    return x;
}

void solve(ll &T)
{
    ll n, m;
    cin>>n>>m;

    graph g(n+1);
    loop(i,0,m)
    {
        ll x, y;
        cin>>x>>y;
        g[x].emplace_back(y);
        g[y].emplace_back(x);
    }

    ans = 0;
    ll x = Bipartite(g);
    ans /= 2;
    if((x & 1) and (n - x) % 2 == ans % 2) ans++;
    cout<<ans<<endl;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt","r",stdin);
        freopen("D:/dhiraj/Programming/o1.txt","w",stdout);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    loop(Case,1,t+1)
    {
        cerr<<"Case #"<<Case<<"\n";
        solve(Case);
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MAX 110

int n, m;
vector<int>adj[MAX];
bool visited[MAX], cycle;

int dfs(int u, int s){
    visited[u] = true;

    for(int i=0; i<adj[u].size(); i++){
        int v = adj[u][i];

        if(!visited[v])
            return dfs(v, u) + 1;
        else if(v!=s){
            cycle = true;
            return 1;
        }
    }

    return 1;
}

void reset(int n){
    for(int i=0; i<n; i++)
        adj[i].clear();
}

int main(){
    //FasterIO;

    while(cin>>n>>m){
        reset(n);

        while(m--){
            int u, v;
            scanf("%d %d",&u,&v);
            u--, v--;
            adj[u].push_back(v);
            adj[v].push_back(u);
        }

        memset(visited, false, sizeof visited);
        int cnt = 0, total = 0;

        for(int i=0; i<n; i++){
            if(!visited[i]){
                cycle = false;
                int visits = dfs(i, -1);

                if(visits!=1 && cycle && visits&1)
                    cnt++;
            }
        }

        n-=cnt;

        if(n&1)
            cnt++;

        cout<<cnt<<endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MAX 110

int n, m;
vector<int>adj[MAX];
bool visited[MAX];

int dfs(int u, int s){
    visited[u] = true;

    for(int i=0; i<adj[u].size(); i++){
        int v = adj[u][i];

        if(!visited[v])
            return dfs(v, u) + 1;
        else if(v!=s)
            return 1;
    }

    return INT_MIN;
}

int main(){
    FasterIO;

    while(cin>>n>>m){
        while(m--){
            int u, v;
            scanf("%d %d",&u,&v);
            u--, v--;
            adj[u].push_back(v);
            adj[v].push_back(u);
        }

        memset(visited, false, sizeof visited);
        int cnt = 0;

        for(int i=0; i<n; i++){
            if(!visited[i]){
                int cycle = dfs(i, -1);

                if(cycle>0 && cycle&1){
                    cnt++;
                }
            }
        }

        cout<<cnt<<endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MAX 110

int n, m;
vector<int>adj[MAX];
bool visited[MAX];

int dfs(int u, int s){
    visited[u] = true;

    for(int i=0; i<adj[u].size(); i++){
        int v = adj[u][i];

        if(!visited[v])
            return dfs(v, u) + 1;
        else if(v!=s)
            return 1;
    }

    return INT_MIN;
}

void reset(int n){
    for(int i=0; i<n; i++)
        adj[i].clear();
}

int main(){
    //FasterIO;

    while(cin>>n>>m){
        while(m--){
            int u, v;
            scanf("%d %d",&u,&v);
            u--, v--;
            adj[u].push_back(v);
            adj[v].push_back(u);
        }

        memset(visited, false, sizeof visited);
        int cnt = 0;

        for(int i=0; i<n; i++){
            if(!visited[i]){
                int cycle = dfs(i, -1);

                if(cycle>0 && cycle&1)
                    cnt++;
            }
        }

        cout<<cnt<<endl;

        reset(n);
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MAX 110

int n, m;
vector<int>adj[MAX];
bool visited[MAX], cycle;

int dfs(int u, int s){
    visited[u] = true;

    for(int i=0; i<adj[u].size(); i++){
        int v = adj[u][i];

        if(!visited[v])
            return dfs(v, u) + 1;
        else if(v!=s){
            cycle = true;
            return 1;
        }
    }

    return 1;
}

void reset(int n){
    for(int i=0; i<n; i++)
        adj[i].clear();
}

int main(){
    //FasterIO;

    while(cin>>n>>m){
        reset(n);

        while(m--){
            int u, v;
            scanf("%d %d",&u,&v);
            u--, v--;
            adj[u].push_back(v);
            adj[v].push_back(u);
        }

        memset(visited, false, sizeof visited);
        int cnt = 0, total = 0;

        for(int i=0; i<n; i++){
            if(!visited[i]){
                cycle = false;
                int visits = dfs(i, -1);

                if(cycle && visits&1)
                    cnt++;
            }
        }

        n-=cnt;

        if(n&1)
            cnt++;

        cout<<cnt<<endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MAX 110

int n, m;
vector<int>adj[MAX];
bool visited[MAX], cycle;

int dfs(int u, int s){
    visited[u] = true;
    int cnt = 1;

    for(int i=0; i<adj[u].size(); i++){
        int v = adj[u][i];

        if(!visited[v])
            cnt += dfs(v, u);
        else if(v!=s){
            cycle = true;
            return cnt;
        }
    }

    return cnt;
}

void reset(int n){
    for(int i=0; i<n; i++)
        adj[i].clear();
}

int main(){
    //FasterIO;

    while(cin>>n>>m){
        reset(n);

        while(m--){
            int u, v;
            scanf("%d %d",&u,&v);
            u--, v--;
            adj[u].push_back(v);
            adj[v].push_back(u);
        }

        memset(visited, false, sizeof visited);
        int cnt = 0, total = 0;

        for(int i=0; i<n; i++){
            if(!visited[i]){
                cycle = false;
                int visits = dfs(i, -1);

                if(cycle && visits&1)
                    cnt++;
            }
        }

        n-=cnt;

        if(n&1)
            cnt++;

        cout<<cnt<<endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MAX 110

int n, m;
vector<int>adj[MAX];
bool visited[MAX], cycle;

int dfs(int u, int s){
    visited[u] = true;
    int cnt = 1;

    for(int i=0; i<adj[u].size(); i++){
        int v = adj[u][i];

        if(!visited[v])
            cnt += dfs(v, u);
        else if(v!=s){
            cycle = true;
            return 1;
        }
    }

    return cnt;
}

void reset(int n){
    for(int i=0; i<n; i++)
        adj[i].clear();
}

int main(){
    //FasterIO;

    while(cin>>n>>m){
        reset(n);

        while(m--){
            int u, v;
            scanf("%d %d",&u,&v);
            u--, v--;
            adj[u].push_back(v);
            adj[v].push_back(u);
        }

        memset(visited, false, sizeof visited);
        int cnt = 0, total = 0;

        for(int i=0; i<n; i++){
            if(!visited[i]){
                cycle = false;
                int visits = dfs(i, -1);

                if(cycle && visits&1)
                    cnt++;
            }
        }

        n-=cnt;

        if(n&1)
            cnt++;

        cout<<cnt<<endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MAX 110

int n, m;
vector<int>adj[MAX];
bool visited[MAX];

int dfs(int u, int s){
    visited[u] = true;

    for(int i=0; i<adj[u].size(); i++){
        int v = adj[u][i];

        if(!visited[v])
            return dfs(v, u) + 1;
        else if(v!=s)
            return 1;
    }

    return INT_MIN;
}

void reset(int n){
    for(int i=0; i<n; i++)
        adj[i].clear();
}

int main(){
    FasterIO;

    while(cin>>n>>m){
        while(m--){
            int u, v;
            scanf("%d %d",&u,&v);
            u--, v--;
            adj[u].push_back(v);
            adj[v].push_back(u);
        }

        memset(visited, false, sizeof visited);
        int cnt = 0;

        for(int i=0; i<n; i++){
            if(!visited[i]){
                int cycle = dfs(i, -1);

                if(cycle>0 && cycle&1){
                    cnt++;
                }
            }
        }

        cout<<cnt<<endl;

        reset(n);
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MAX 110

int n, m;
vector<int>adj[MAX];
bool visited[MAX], cycle;

int dfs(int u, int s){
    visited[u] = true;

    for(int i=0; i<adj[u].size(); i++){
        int v = adj[u][i];

        if(!visited[v])
            return dfs(v, u) + 1;
        else if(v!=s){
            cycle = true;
            return 1;
        }
    }

    return 1;
}

void reset(int n){
    for(int i=0; i<n; i++)
        adj[i].clear();
}

int main(){
    //FasterIO;

    while(cin>>n>>m){
        while(m--){
            int u, v;
            scanf("%d %d",&u,&v);
            u--, v--;
            adj[u].push_back(v);
            adj[v].push_back(u);
        }

        memset(visited, false, sizeof visited);
        int cnt = 0, total = 0;;

        for(int i=0; i<n; i++){
            if(!visited[i]){
                int howMany = dfs(i, -1);
                if(howMany==1) continue;
                total+=howMany;

                if(cycle && howMany&1)
                    cnt++;
                cycle = false;
            }
        }

        int ans = cnt + ((n-total)&1);

        cout<<ans<<endl;

        reset(n);
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define FasterIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define MAX 110

int n, m;
vector<int>adj[MAX];
bool visited[MAX], cycle;

int dfs(int u, int s){
    visited[u] = true;

    for(int i=0; i<adj[u].size(); i++){
        int v = adj[u][i];

        if(!visited[v])
            return dfs(v, u) + 1;
        else if(v!=s){
            cycle = true;
            return 1;
        }
    }

    return 1;
}

void reset(int n){
    for(int i=0; i<n; i++)
        adj[i].clear();
}

int main(){
    //FasterIO;

    while(cin>>n>>m){
        reset(n);

        while(m--){
            int u, v;
            scanf("%d %d",&u,&v);
            u--, v--;
            adj[u].push_back(v);
            adj[v].push_back(u);
        }

        memset(visited, false, sizeof visited);
        int cnt = 0, total = 0;

        for(int i=0; i<n; i++){
            if(!visited[i]){
                cycle = false;

                int visits = dfs(i, -1);

                if(visits==1) continue;

                n-=visits;

                if(cycle && visits&1)
                    cnt++;
                else if(visits&1)
                    n++;
            }
        }

        int ans = cnt + (n&1);

        cout<<ans<<endl;
    }

    return 0;
}


#include<iostream>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;
#define all(v)				((v).begin()), ((v).end())
#define sz(v)				((int)((v).size()))
#define clr(v, d)			memset(v, d, sizeof(v))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
const ll OO = 1e8;

const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}

#define pb					push_back
#define MP					make_pair
#define P(x)				cout<<#x<<" = { "<<x<<" }\n"
typedef long double   	  ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;

vector<bool> visited;
vvi adjList;
vi start;
vi finish;
int timer = 0;

int noOfNodes = 0;
int result = 0;
bool cycle = false;

void dfs(int node,int parent){

    if(visited[node])return ;
    visited[node] = true;
    rep(i,adjList[node]){
        int child = adjList[node][i];

        if(!visited[child]){
            noOfNodes++;
            dfs(child,parent);
        }
        else if(child==parent && noOfNodes>1)cycle=true;
    }

}

int main() {

    int n,m;
    cin>>n>>m;

    adjList = vvi (n);
    visited = vector<bool> (n);
    start = vi (n,-1);
    finish = vi (n,-1);
    lp(i,m){
        int from,to;
        cin>>from>>to;
        adjList[from-1].push_back(to-1);
        adjList[to-1].push_back(from-1);

    }
    lp(i,n){
        if(!visited[i]) {
            noOfNodes=0;
            cycle = false;
            dfs(i, i);
            if (cycle) {
                if (noOfNodes % 2 == 0) {
                    result++;
                }

            }
        }
    }

    if((n-result)%2!=0)
        cout<<result+1<<endl;
    else
        cout<<result<<endl;

}


#include<iostream>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;
#define all(v)				((v).begin()), ((v).end())
#define sz(v)				((int)((v).size()))
#define clr(v, d)			memset(v, d, sizeof(v))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
const ll OO = 1e8;

const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}

#define pb					push_back
#define MP					make_pair
#define P(x)				cout<<#x<<" = { "<<x<<" }\n"
typedef long double   	  ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;

vector<bool> visited;
vvi adjList;
vi start;
vi finish;
int timer = 0;

int noOfNodes = 0;
int result = 0;
bool cycle = false;

void dfs(int node,int parent){

    if(visited[node])return ;
    visited[node] = true;
    rep(i,adjList[node]){
        int child = adjList[node][i];
        if(node==parent)noOfNodes=0;
        if(!visited[child]){
            noOfNodes++;
            dfs(child,parent);
        }
        else if(child==parent && noOfNodes>1)cycle=true;

    }

}

int main() {
    /*ifstream cin;
    ofstream cout;
    cin.open("input.txt");
    cout.open("output.txt");*/

    int n,m;
    cin>>n>>m;

    adjList = vvi (n);
    visited = vector<bool> (n);
    start = vi (n,-1);
    finish = vi (n,-1);
    lp(i,m){
        int from,to;
        cin>>from>>to;
        adjList[from-1].push_back(to-1);
        adjList[to-1].push_back(from-1);

    }
    lp(i,n){
        if(!visited[i]) {
            noOfNodes=0;
            cycle = false;
            dfs(i, i);
            if (cycle) {
                if (noOfNodes % 2 == 0) {
                    result++;
                }

            }
        }
    }

    if((n-result)%2!=0)
        cout<<result+1<<endl;
    else
        cout<<result<<endl;

}


#include <iostream>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;
#define all(v)				((v).begin()), ((v).end())
#define sz(v)				((int)((v).size()))
#define clr(v, d)			memset(v, d, sizeof(v))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
const ll OO = 1e8;

const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}

#define pb					push_back
#define MP					make_pair
#define P(x)				cout<<#x<<" = { "<<x<<" }\n"
typedef long double   	  ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;

vector<bool> visited;
vvi adjList;

int noOfNodes=0;
int result = 0;
void dfs(int node){
    visited[node] = true;
    noOfNodes++;
    rep(i,adjList[node]){
        int child = adjList[node][i];
        if(!visited[child]){
            dfs(child);
        }
        else{
            if(noOfNodes%2!=0)result++;
            noOfNodes=0;

        }

    }
}

int main() {

    int n,m;
    cin>>n>>m;

    adjList = vvi (n);
    visited = vector<bool> (n);
    lp(i,m){
        int from,to;
        cin>>from>>to;
        adjList[from-1].push_back(to-1);

    }
    lp(i,n){
        if(!visited[i])
            dfs(i);
    }
    cout<<result<<endl;

}


#include <iostream>
#include <vector>
using namespace std;

int main() {

	int n, m;
	cin >> n >> m;
	vector<bool> row(n, 0);
	vector<vector<bool>> col(n, row);
	for (int i = 0; i < m; i++) {
		int from, to;
		cin >> from >> to;
		col[from-1][to-1] = 1;
		col[to-1][from-1] = 1;
	}
	int sum = 0;
	for (int i = 0; i < n-1; i++) {
		for(int x = i+1;x<n;x++){
			for (int j = 0; j < n; j++) {
				if (col[i][j] && col[x][j]) {
					if (col[i][x]) {
						sum++;
						col[j] = row;
					}
				}
			}

		}
	}
	cout << sum << endl;

}


#include <iostream>
#include <vector>
using namespace std;

bool can_join(vector<int> &team, vector<vector<bool>> &graph , int player) {
	for (int i = 0, l = team.size(); i < l; i++) {
		if (graph[team[i]][player])return false;
	}
	return true;

}

int main() {

	int n, m;
	cin >> n >> m;
	vector<bool> row(n, 0);
	vector<vector<bool>> col(n, row);
	for (int i = 0; i < m; i++) {
		int from, to;
		cin >> from >> to;
		col[from-1][to-1] = 1;
		col[to-1][from-1] = 1;
	}
	int sum = 0;
	/*
	for (int i = 0; i < n-1; i++) {
		for(int x = i+1;x<n;x++){
			for (int j = 0; j < n; j++) {
				if (col[i][j] && col[x][j]) {
					if (col[i][x]) {
						sum++;
						col[j] = row;
					}
				}
			}

		}
	}*/

	vector<int> team1;
	vector<int> team2;
	for (int i = 0; i < n; i++) {
		if (can_join(team1, col, i)) {
			team1.push_back(i);
		}
		else if (can_join(team2, col, i)) {
			team2.push_back(i);
		}
		else sum++;
	}
	cout << sum << endl;

}


#include<iostream>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;
#define all(v)				((v).begin()), ((v).end())
#define sz(v)				((int)((v).size()))
#define clr(v, d)			memset(v, d, sizeof(v))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
const ll OO = 1e8;

const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}

#define pb					push_back
#define MP					make_pair
#define P(x)				cout<<#x<<" = { "<<x<<" }\n"
typedef long double   	  ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;

vector<bool> visited;
vvi adjList;
vi start;
vi finish;
int timer = 0;

int noOfNodes = 0;
int result = 0;
bool cycle = false;

void dfs(int node,int parent){

    if(visited[node])return ;
    visited[node] = true;
    rep(i,adjList[node]){
        int child = adjList[node][i];

        if(!visited[child]){
            noOfNodes++;
            dfs(child,parent);
        }
        else if(child==parent && noOfNodes>1)cycle=true;
    }

}

int main() {
    /*ifstream cin;
    ofstream cout;
    cin.open("input.txt");
    cout.open("output.txt");*/

    int n,m;
    cin>>n>>m;

    adjList = vvi (n);
    visited = vector<bool> (n);
    start = vi (n,-1);
    finish = vi (n,-1);
    lp(i,m){
        int from,to;
        cin>>from>>to;
        adjList[from-1].push_back(to-1);
        adjList[to-1].push_back(from-1);

    }
    lp(i,n){
        if(!visited[i])
            dfs(i,i);
            if(cycle) {
                if(noOfNodes%2==0){
                    result++;
                }
                noOfNodes=0;
                cycle = false;
            }
    }

    if((n-result)%2!=0)
        cout<<result+1<<endl;
    else
        cout<<result<<endl;

}


#include<iostream>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;
#define all(v)				((v).begin()), ((v).end())
#define sz(v)				((int)((v).size()))
#define clr(v, d)			memset(v, d, sizeof(v))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
const ll OO = 1e8;

const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}

#define pb					push_back
#define MP					make_pair
#define P(x)				cout<<#x<<" = { "<<x<<" }\n"
typedef long double   	  ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;

vector<bool> visited;
vvi adjList;

int noOfNodes=0;
int result = 0;
void dfs(int node){
    visited[node] = true;
    noOfNodes++;
    rep(i,adjList[node]){
        int child = adjList[node][i];
        if(!visited[child]){
            dfs(child);
        }
        else{
            if(noOfNodes%2!=0)result++;
            noOfNodes=0;

        }

    }
}

int main() {

    int n,m;
    cin>>n>>m;

    adjList = vvi (n);
    visited = vector<bool> (n);
    lp(i,m){
        int from,to;
        cin>>from>>to;
        adjList[from-1].push_back(to-1);

    }
    lp(i,n){
        if(!visited[i])
            dfs(i);
    }
    if((n-result)%2!=0)
        cout<<result+1<<endl;
    else
        cout<<result<<endl;

}


#include<iostream>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;
#define all(v)				((v).begin()), ((v).end())
#define sz(v)				((int)((v).size()))
#define clr(v, d)			memset(v, d, sizeof(v))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
const ll OO = 1e8;

const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}

#define pb					push_back
#define MP					make_pair
#define P(x)				cout<<#x<<" = { "<<x<<" }\n"
typedef long double   	  ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;

vector<bool> visited;
vvi adjList;
vi start;
vi finish;
int timer = 0;

int noOfNodes = 0;
int result = 0;
bool cycle = false;

void dfs(int node,int parent){

    if(visited[node])return ;
    visited[node] = true;
    rep(i,adjList[node]){
        int child = adjList[node][i];
        if(node==parent && !visited[child])noOfNodes=0;
        if(!visited[child]){
            noOfNodes++;
            dfs(child,parent);
        }
        else if(child==parent && noOfNodes>1)cycle=true;

    }

}

int main() {
    /*ifstream cin;
    ofstream cout;
    cin.open("input.txt");
    cout.open("output.txt");*/

    int n,m;
    cin>>n>>m;

    adjList = vvi (n);
    visited = vector<bool> (n);
    start = vi (n,-1);
    finish = vi (n,-1);
    lp(i,m){
        int from,to;
        cin>>from>>to;
        adjList[from-1].push_back(to-1);
        adjList[to-1].push_back(from-1);

    }
    lp(i,n){
        if(!visited[i]) {
            noOfNodes=0;
            cycle = false;
            dfs(i, i);
            if (cycle) {
                if (noOfNodes % 2 == 0) {
                    result++;
                }

            }
        }
    }

    if((n-result)%2!=0)
        cout<<result+1<<endl;
    else
        cout<<result<<endl;

}


#include<iostream>
#include<set>
#include<map>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
using namespace std;
#define all(v)				((v).begin()), ((v).end())
#define sz(v)				((int)((v).size()))
#define clr(v, d)			memset(v, d, sizeof(v))
#define rep(i, v)		for(int i=0;i<sz(v);++i)
#define lp(i, n)		for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)	for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)	for(int i=(j);i>=(int)(n);--i)

typedef long long         ll;
const ll OO = 1e8;

const double EPS = (1e-7);
int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}

#define pb					push_back
#define MP					make_pair
#define P(x)				cout<<#x<<" = { "<<x<<" }\n"
typedef long double   	  ld;
typedef vector<int>       vi;
typedef vector<double>    vd;
typedef vector< vi >      vvi;
typedef vector< vd >      vvd;
typedef vector<string>    vs;

vector<bool> visited;
vvi adjList;

int noOfNodes=0;
int result = 0;
void dfs(int node){
    visited[node] = true;
    noOfNodes++;
    rep(i,adjList[node]){
        int child = adjList[node][i];
        if(!visited[child]){
            dfs(child);
        }
        else{
            if(noOfNodes%2!=0)result++;
            noOfNodes=0;

        }

    }
}

int main() {
    /*ifstream cin;
    ofstream cout;
    cin.open("input.txt");
    cout.open("output.txt");
     */
    int n,m;
    cin>>n>>m;

    adjList = vvi (n);
    visited = vector<bool> (n);
    lp(i,m){
        int from,to;
        cin>>from>>to;
        adjList[from-1].push_back(to-1);

    }
    lp(i,n){
        if(!visited[i])
            dfs(i);
    }
    cout<<result<<endl;

}