#899
Gold III
AVOGADRO
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Luka is slacking again during chemistry class, while the teacher is explaining Avogadro's law. Luka first drew a table consisting of 3 rows and N columns. Then he wrote the numbers 1 to N into the first row in arbitrary order, each number appearing exactly once. In the other two rows he also wrote integers between 1 and N, but didn't care how many times a number appeared. Luka can now delete any set of columns from the table. After doing so, he sorts the numbers in each row in ascending order. He wants to obtain a table in which all three rows are identical after sorting. Write a program that determines the smallest number of columns he must delete.

입력

The first line of input contains the integer N (1 ≤ N ≤ 100 000), the number of columns in the table. The following three lines contain N integers each, separated by single spaces. The numbers will be between 1 and N, and there will be no duplicates in the first row.

출력

Output the smallest number of columns Luka must delete.

예제 입력 1

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

예제 출력 1

4

예제 입력 2

9
1 3 5 9 8 6 2 4 7
2 1 5 6 4 9 3 4 7
3 5 1 9 8 6 2 8 7

예제 출력 2

2
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Gold III1명 투표· 약 1개월 전
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.