1 //It is made by jump~
2 #include <iostream>
3 #include <cstdlib>
4 #include <cstring>
5 #include <cstdio>
6 #include <cmath>
7 #include <algorithm>
8 #include <ctime>
9 #include <vector>
10 #include <queue>
11 #include <map>
12 #include <set>
13 #ifdef WIN32
14 #define OT "%I64d"
15 #else
16 #define OT "%lld"
17 #endif
18 using namespace std;
19 typedef long long LL;
20 const int MAXM = 2011;
21 int n,m,match[MAXM],ecnt,ans;
22 bool vis[MAXM];
23 int first[MAXM],next[MAXM*10],to[MAXM*10];
24
25 inline int getint()
26 {
27 int w=0,q=0;
28 char c=getchar();
29 while((c<‘0‘ || c>‘9‘) && c!=‘-‘) c=getchar();
30 if (c==‘-‘) q=1, c=getchar();
31 while (c>=‘0‘ && c<=‘9‘) w=w*10+c-‘0‘, c=getchar();
32 return q ? -w : w;
33 }
34
35 inline void link(int x,int y){
36 next[++ecnt]=first[x]; first[x]=ecnt; to[ecnt]=y;
37 next[++ecnt]=first[y]; first[y]=ecnt; to[ecnt]=x;
38 }
39
40 inline bool dfs(int x){
41 vis[x]=1;
42 for(int i=first[x];i;i=next[i]) {
43 int v=to[i];
44 if(vis[v]) continue;
45 vis[v]=1;
46 if(!match[v] || dfs(match[v])) {
47 match[v]=x; match[x]=v;
48 return true;
49 }
50 }
51 return false;
52 }
53
54 inline void work(){
55 n=getint(); m=getint(); int x,y;
56 for(int i=1;i<=m;i++) {
57 x=getint()+1; y=getint()+1;
58 link(i+n,x); link(i+n,y);
59 }
60 for(int i=1;i<=m;i++) {
61 memset(vis,0,sizeof(vis));
62 if(dfs(i+n)) ans++; else break;
63 }
64 printf("%d",ans);
65 }
66
67 int main()
68 {
69 work();
70 return 0;
71 }