cho.sh
Notes
Loading...

Remarkable Students

Time limit

2s

Memory limit

192 MB

Problem

N students took three exams. Every student took all three exams, and within each exam no two students have the same rank.

Student A is stronger than student B if A has a better rank than B in all three exams. A student C is remarkable if no other student is stronger than C.

Given the rankings from the three exams, determine how many students are remarkable.

Input

The first line contains N (1 ≤ N ≤ 500,000), the number of students. Each of the next three lines lists the student numbers from rank 1 to rank N for one exam. Student numbers are from 1 to N.

Output

Print the number of remarkable students on the first line.