P23446 [AtCoder] [ARC024A] Shoes Matching
入门
题目描述

Problem Description

ARC Mart is a shoe store that operates only on Saturdays. They handle only one type of shoe, differentiated only by size. Unfortunately, when they opened the store after a week, it appeared that a burglary had occurred, and the shoes were scattered everywhere.

When they gathered all the remaining shoes, they found $ L $ left shoes and $ R $ right shoes. However, to sell the shoes, they must pair them by size for both feet. Since all shoes are of the same type, it seems that only the size needs to be considered when making pairs.

As there is little time left before opening, please help the shop owner determine the maximum number of pairs that can be made.

Input Format

The input is given from the standard input in the following format:

$ L $ $ R $ $ l_1 $ $ l_2 $ … $ l_L $ $ r_1 $ $ r_2 $ … $ r_R $

  • The first line contains the number of left shoes found $L\ (1\ ≦\ L\ ≦\ 100)$ and the number of right shoes found $R\ (1\ ≦\ R\ ≦\ 100)$ separated by a space.
  • The second line contains $ L $ integers separated by spaces. The $ i $ -th integer is the size of the $ i $ -th left shoe $l_i\ (10\ ≦\ l_i\ ≦\ 40)$.
  • The third line contains $ R $ integers separated by spaces. The $ i $ -th integer is the size of the $ i $ -th right shoe $r_i\ (10\ ≦\ r_i\ ≦\ 40)$.

Output Format

Output the maximum number of shoe pairs that can be created in one line.

Sample Input and Output

Sample Input #1

3 3
20 21 22
30 22 15

Sample Output #1

1

Sample Input #2

3 4
10 11 10
12 10 11 25

Sample Output #2

2

Sample Input #3

5 5
10 10 10 10 10
10 10 10 10 10

Sample Output #3

5

Sample Input #4

5 5
10 11 12 13 14
30 31 32 33 34

Sample Output #4

0

Notes/Hints

Sample Explanation 1

Only one pair of size $ 22 $ can be made.

Sample Explanation 2

One pair of size $ 10 $ and one pair of size $ 11 $ can be made.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 3 20 21 22 30 22 15
样例输出
1