#include <bits/stdc++.h>
using namespace std;


vector<long long int>UF;

long long int pearent( long long int now ) {
	if( UF[now] == now ) {
		return now;
	} else {
		return UF[now] = pearent( UF[now] );
	}
}

void merge( long long int x, long long int y ) {
	UF[pearent( x )] = UF[pearent( y )];
}

int main() {
	long long int N, M;
	cin >> N >> M;
	UF = vector<long long int>( N );
	vector<bool>qwe( N );
	for( size_t i = 0; i < N; i++ ) {
		UF[i] = i;
	}
	for( size_t i = 0; i < M; i++ ) {
		long long int a, b;
		cin >> a >> b;
		a--; b--;
		qwe[a] = 1;
		qwe[b] = 1;
		merge( a, b );
	}
	long long int ans = 0;
	long long int num = 0;
	for( size_t i = 0; i < N; i++ ) {

		if( UF[i] == i ) {
			ans++;
			if( qwe[i] == false ) {
				num++;
			}
		}
	}
	cout << abs( (ans - num) - num ) << endl;
}