#P8833. [传智杯 #3 决赛] 课程

[传智杯 #3 决赛] 课程

Description

Chuanzhi Professional Academy offers two courses A,BA, B, with n,mn, m students enrolled respectively. The IDs of students enrolled in AA are ana_n, and the IDs of students enrolled in BB are bmb_m. Find how many students enrolled in both courses.

For all testdata, n,m,ai,bi20n, m, a_i, b_i \leq 20. It is guaranteed that the student IDs enrolled in each course will not repeat.

Input Format

The input has 33 lines.

The first line contains two positive integers n,mn, m.

The second line contains nn positive integers a1ana_1 \ldots a_n, representing the student IDs enrolled in course AA.

The third line contains mm positive integers b1bmb_1 \ldots b_m, representing the student IDs enrolled in course BB.

The student IDs are not guaranteed to be sorted in increasing order.

Output Format

Output one line containing one integer, which is the answer.

5 5
1 2 3 4 5
1 3 4 5 6
4

Hint

Sample Explanation

We find that these 44 students with IDs 1,3,4,51, 3, 4, 5 enrolled in both courses, so the answer is 44.

Translated by ChatGPT 5