시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 19 8 8 53.333%

## 문제

Will the galaxy see peace at last? All the warlords have gathered to divide all of space between themselves. The negotiations have come quite far and the warlords have ﬁnally agreed on a peaceful way of deciding who gets what. The 2-dimensional galactic map must ﬁrst be divided into sectors by splitting it along a set of inﬁnite lines. The warlord with the largest battle ﬂeet will choose one sector, then the warlord with the second largest ﬂeet will choose some other sector and so on, until everyone has gotten a sector. This is then repeated until there are no sectors left.

Different sets of lines have been suggested, and it is up to you to present these alternatives to the meeting. To make sure that there will be peace, you are ready to modify the suggestions slightly. You have some experience with warlords and know that no warlord will settle for less space than anyone else, so for there to be peace, all of them must get the exact same area on the map. Since space is inﬁnite, so is the map. Some sectors will therefore have inﬁnite area, so that is the amount of space everyone will want. How many extra lines will you have to add to make sure each warlord can get at least one sector with inﬁnite area?

## 입력

The ﬁrst line of input contains two positive integers W and N, (1 ≤ W, N ≤ 100) denoting the number of warlords and the number of lines in the suggested division of space. This is followed by N lines each containing four integers x1, y1, x2 and y2, each with an absolute value no higher than 10 000. This means that one line is intersecting the two points (x1, y1) and (x2, y2) on the galactic map. These two points will not be the same.

## 출력

Output the number of lines you will have to add to this suggestion to satisfy all warlords.

## 예제 입력 1

2 1
1 1 -2 0


## 예제 출력 1

0


## 예제 입력 2

5 3
0 5 5 5
0 0 1 1
2 2 3 3


## 예제 출력 2

1