Zonal Computing Olympiad 2010, 12 Dec 2009

10:00 am–1:00 pm IST

Problem 2 : Library Committee

The Siruseri Public Library has a Library Committee with three members. The financial year is coming to an end and there is a mad rush to spend this year's budget. Each committee member has independently drawn up a list of books that he wants to order for the library.

For simplicity, each book is identified by a unique number, so each committee member's recommendation is a list of numbers, in some arbitrary order. It is possible that two or more committee members have recommended the same book. The numbers have the same meaning across lists, so if the same number appears in multiple lists, it denotes the same book.

For example, the three lists may be as follows:

  • Member 1: [12,387,15,162,5]

  • Member 2: [14,162,92,387,7,748]

  • Member 3: [14,5,12,387]

In this case, all three members have recommended book 387, only member 1 has recommended book 15, two members have recommended book 162 and so on.

There is enough money to buy all the books that have been recommended, but only one copy of each book may be purchased. Your task is to to calculate how many books, overall, are to be bought, given the three lists of recommended books. In this example, the answer is 9: the list of books to be ordered overall is [12,387,15,162,5,14,92,7,748]

Input format

The first line of the input contains three integers N1, N2 and N3, where Nj is the number of books recommended by committee member j, 1 ≤ j ≤ 3. This is followed by three lines of space separated integers.

  • Line 2 of the input has N1 integers representing the recommendations of Member 1.
  • Line 3 of the input has N2 integers representing the recommendations of Member 2.
  • Line 4 of the input has N3 integers representing the recommendations of Member 3.

Output format

Your output should be a single line consisting of one integer, the total number of books to be ordered for the library.

Testdata

In all cases, 1 ≤ N1, N2, N3 ≤ 106. Also, each individual list is guaranteed to be free of duplicate entries.

Sample Input

5 6 4
12 387 15 162 5
14 162 92 387 7 748
14 5 12 387

Sample Output

9



Copyright (c) IARCS 2003-2024;   Last Updated: 10 Sep 2010