#include #include #include using namespace std; /* #include using namespace atcoder; using mint = modint1000000007; */ #define all(x) (x).begin(),(x).end() #define rep(i, n) for (int i = 0; i < (n); i++) #define endl "\n" #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") typedef long long ll; typedef pair pii; typedef pair pll; template ostream &operator<<(ostream &os, const vector &vec) {os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os;} template ostream &operator<<(ostream &os, const pair &p) {os << "(" << p.first << ", " << p.second << ")"; return os;} ll mod_pow(ll a, ll n, ll mod) { ll ret = 1; ll p = a % mod; while (n) { if (n & 1) ret = ret * p % mod; p = p * p % mod; n >>= 1; } return ret; } const int mod = 1e9 + 7; struct UnionFind { vector data; int gnum; UnionFind(int size) : data(size, -1), gnum(size) {} bool unionSet(int x, int y) { x = root(x); y = root(y); if (x != y) { if (data[y] < data[x]) swap(x, y); data[x] += data[y]; data[y] = x; gnum--; } return x != y; } bool findSet(int x, int y) { return root(x) == root(y); } int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); } int size(int x) { return -data[root(x)]; } int getGroupNum() { return gnum; } vector> getGroups() { map> G; int N = data.size(); for (int i = 0; i < N; i++) { G[root(i)].push_back(i); } vector> ret; for(auto g : G) { ret.push_back(g.second); } return ret; } }; void solve() { int N, M; cin >> N >> M; N *= 2; UnionFind uf(N); for (int i = 0; i < M; i++) { int a, b; cin >> a >> b; a--, b--; uf.unionSet(a, b); } vector> G = uf.getGroups(); int cnt = 0; for (int i = 0; i < G.size(); i++) { if (G[i].size() % 2 == 1) cnt++; } cout << cnt / 2 << endl; } int main() { #ifdef LOCAL_ENV cin.exceptions(ios::failbit); #endif cin.tie(0); ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(16); solve(); }