n,m=map(int,input().split()) X=[None] for i in range(n): X.append([0,0]) for i in range(m): a,b=map(int,input().split()) X[a][0]+=1 X[b][1]+=1 ans=0 for i in range(1,n+1): ans+=abs(X[i][0]-X[i][1]) print(ans//2-1)