#include using namespace std; using ll = long long; const ll MOD = 1000000007; const long long INF = 1LL << 60; #define rep(i,n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() int main() { int n, q, ans = 0; cin >> n >> q; vector a(n+1); rep(i,q){ int l, r; cin >> l >> r; a[l]++; a[r]++; } int b; for(int x : a){ b += x; if(b%2==1) ans++; } cout << ans << endl; }