#include using namespace std; using ll=long long; int main(){ ll n,m; cin>>n>>m; vector> G(2*n); for(ll i=0;i>a>>b; a--; b--; G[a].push_back(b); G[b].push_back(a); } vector seen(n,false); queue que; ll ans=0; ll rest=2*n; for(ll i=0;i<2*n;i++){ if(!seen[i]){ ll cnt=0; seen[i]=true; que.push(i); while(que.size()){ ll q=que.front(); que.pop(); cnt++; for(ll u:G[q]){ if(!seen[u]){ seen[u]=true; que.push(u); } } } if(cnt%2==0){ ans+=cnt/2; rest-=cnt; }else{ ans+=cnt/2; rest-=(cnt-1); } } } cout<