def fut(ut,no)
	if ut[no]==no then
		return no
	else
		ut[no]=fut(ut,ut[no])
		return ut[no]
	end
end
n,m=gets.split(" ").map{|e| e.to_i}
ut=[0]
utc=[0]
1.upto(2*n){|i|
	ut<<i
	utc<<1
}
m.times{
	a,b=gets.split(" ").map{|e| e.to_i}
	atop=fut(ut,a)
	btop=fut(ut,b)
	next if atop==btop
	ut[atop]=btop
	utc[btop]+=utc[atop]
}
ans=0
1.upto(2*n){|i|
	itop=fut(ut,i)
	ans+=utc[itop]%2
	utc[itop]=0
}
puts ans/2