#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
const int N=2050;
const int M=10050;
int n,m;
int u,v;
struct Edge{
int to,next;
}edge[M];
int cnt;
int head[N];
void init(){
cnt=0;
memset(head,-1,sizeof(head));
}
void addEdge(int u,int v){
edge[cnt]=Edge{
v,head[u]};
head[u]=cnt++;
edge[cnt]=Edge{
u,head[v]};
head[v]=cnt++;
}
int link[N];
bool vis[N];
bool dfs(int u){
for(int i=head[u];i!=-1;i=edge[i].next){
int v=edge[i].to;
if(!vis[v]){
vis[v]=true;
if(link[v]==-1 || dfs(link[v])){
link[v]=u;
return true;
}
}
}
return false;
}
int hungary(){
int res=0;
memset(link,-1,sizeof(link));
for(int u=1;u<=n;u++){
memset(vis,false,sizeof(vis));
if(dfs(u)){
res++;
}
}
return res;
}
int main(void){
scanf("%d%d",&n,&m);
init();
while(m--){
scanf("%d%d",&u,&v);
addEdge(u,v);
}
printf("%d\n",hungary()/2);
return 0;
}