PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#DSU0000010. Bò và đồ ăn nhẹ (Cow and Snacks)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Bò và đồ ăn nhẹ (Cow and Snacks)

Cow and Snacks

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn snack flavors, with exactly one snack of each flavor. Each of the mm guests likes exactly two distinct flavors and eats all remaining snacks of both preferred flavors when served. A guest is unhappy if both preferred flavors are unavailable. You may choose the order in which guests are served. Minimize the number of unhappy guests.

Input

The first line contains two integers n,mn,m. Each of the next mm lines contains two integers x,yx,y, denoting the two flavors preferred by one guest. Flavors are numbered from 11 to nn.

Output

Print the minimum possible number of unhappy guests.

Subtasks

  • Subtask 1 (20 points): 2≤n≤1502\le n\le 150; 1≤m≤1701\le m\le 170; 1≤x,y≤n1\le x,y\le n; x≠yx\ne y.
  • Subtask 2 (30 points): 2≤n≤100002\le n\le 10000; 1≤m≤60001\le m\le 6000; 1≤x,y≤n1\le x,y\le n; x≠yx\ne y.
  • Subtask 3 (50 points): 2≤n≤1000002\le n\le 100000; 1≤m≤1000001\le m\le 100000; 1≤x,y≤n1\le x,y\le n; x≠yx\ne y.

Examples

Input

5 4
1 2
4 3
1 4
3 4

Output

1

Explanation

Serve guests in the order 3,1,2,43,1,2,4. Guest 33 eats flavors 11 and 44, guest 11 eats flavor 22, and guest 22 eats flavor 33. No preferred snack remains for guest 44, so one guest is unhappy.