#t521. 珍珠

珍珠

Pearls

Problem Background

Special for beginners, ^_^

Problem Description

There are nn pearls that are identical in shape and size, but their weights are all different. nn is an integer, and all the pearls are numbered from 11 to nn. Your task is to find out which pearl has exactly the middle weight, i.e. its weight ranks (n+1)/2(n+1)/2-th among all the pearls' weights. The following is a way to compare a pair of pearls:

You are given a balance to compare the weights of pearls; we can tell which of two pearls is heavier. After a series of comparisons, we can remove some pearls that definitely do not have the middle weight.

For example, the following shows four comparisons on 55 pearls:

  1. Pearl 22 is heavier than pearl 11;
  2. Pearl 44 is heavier than pearl 33;
  3. Pearl 55 is heavier than pearl 11;
  4. Pearl 44 is heavier than pearl 22.

From the above results, although we cannot precisely find which pearl has the middle weight, we can be sure that pearl 11 and pearl 44 cannot have the middle weight, because pearls 2,4,52, 4, 5 are heavier than pearl 11, while pearls 1,2,31, 2, 3 are lighter than pearl 44, so we can remove these two pearls.

Write a program to count how many pearls are definitely not of middle weight.

Input Format

The first line of input contains two integers separated by a space: NN and MM, where 1≤N≤991 \le N \le 99 and NN is odd. MM is the number of comparisons made on the pearls. The following MM lines each contain two integers separated by a space: xx and yy, meaning pearl xx is heavier than pearl yy.

Output Format

Output a single line containing one integer: the total number of pearls that cannot be of middle weight.

Sample Input

123 500

Sample Output

623

Constraints

Time limit: 1s; memory limit: 1024 KiB for each test case.