#include<cstdio> #include<iostream> #include<cmath> #include<string> #include<string> #include<algorithm> usingnamespacestd; structedge { int to; int next; }e[200000]; int head[20000]; int cnt,black,white; voidadd(int a, int b) { cnt++; e[cnt].to = b; e[cnt].next = head[a]; head[a] = cnt; } bool used[20000]; int col[20000]; booldfs(int node, int color) { if (used[node])return (col[node] == color); used[node] = true; col[node] = color; if (color) white++; else black++; for (int i = head[node]; i; i = e[i].next) { if(!dfs(e[i].to, 1 - color))return0; } return1; } intmain() { int n, m; scanf("%d%d", &n, &m); int a, b; while (m--) { scanf("%d%d", &a, &b); add(a, b); add(b, a); } int ans = 0; for (int i = 1; i <= n; i++) { if (used[i])continue; black = white = 0; if (!dfs(i, 0)) { printf("Impossible"); return0; } ans += min(black, white); } printf("%d", ans); return0; }