1 #include <iostream>
2 #include <cstdio>
3 #include <cstdlib>
4 #include <cstring>
5
6 inline void read(int &x)
7 {
8 x = 0;char ch = getchar(), c = ch;
9 while(ch < ‘0‘ || ch > ‘9‘)c = ch, ch = getchar();
10 while(ch <= ‘9‘ && ch >= ‘0‘)x = x * 10 + ch - ‘0‘, ch = getchar();
11 if(c == ‘-‘)x = -x;
12 }
13
14 const int MAXN = 1000 + 10;
15 const int MAXM = 1000 + 10;
16
17 struct Edge
18 {
19 int u,v,next;
20 Edge(int _u, int _v, int _next){u = _u;v = _v;next = _next;}
21 Edge(){}
22 }edge[MAXN << 1];
23
24 int n,m,head[MAXN],cnt;
25
26 inline void insert(int a, int b)
27 {
28 edge[++cnt] = Edge(a,b,head[a]);
29 head[a] = cnt;
30 }
31
32 int lk[MAXN], b[MAXN];
33
34 int dfs(int u)
35 {
36 for(register int pos = head[u];pos;pos = edge[pos].next)
37 {
38 int v = edge[pos].v;
39 if(!b[v])
40 {
41 b[v] = 1;
42 if(lk[v] == -1 || dfs(lk[v]))
43 {
44 lk[v] = u;
45 return 1;
46 }
47 }
48 }
49 return 0;
50 }
51
52 int xiongyali()
53 {
54 int ans = 0;
55 memset(lk, -1, sizeof(lk));
56 for(register int i = 1;i <= m;++i)
57 {
58 memset(b, 0, sizeof(b));
59 if(dfs(i))++ ans;
60 else return ans;
61 }
62 return ans;
63 }
64
65 int main()
66 {
67 read(n), read(m);
68 register int tmp1, tmp2;
69 for(register int i = 1;i <= m;++ i)
70 {
71 read(tmp1), read(tmp2);
72 insert(i, tmp2);
73 insert(i, tmp1);
74 }
75 printf("%d", xiongyali());
76 return 0;
77 }