## DMOPC '14 Contest 8 P3 - Globally Unique Shells

View as PDF

Points: 6 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

Stranded on an island, Tusk decided to kill time by collecting shells. But he doesn't want just any broken shell: he's interested in bivalves — that is, shells with both the right and left halves (valves) intact.

A bivalve.

In fact, he spent so much time searching that he's collected such mollusks.

Tusk has a programming hobby, so he killed some more time by assigning each mollusk a GUID (strangely, these "GUIDs" are integers from , but they still satisfy the property that they're pairwise distinct). Each mollusk has both its left and right halves labeled with the same GUID.

A labeled bivalve.

However, in an unfortunate turn of events, he accidentally smashed into the shells with a giant aircraft. In doing so, all of the bivalves have broken apart into their respective valves. On top of this, a number of valves were either crushed or lost.

Tusk has collected and repaired all the shells he can. How many were crushed or lost?

#### Input Specification

The first line of input will contain the single integer , the original number of mollusks.
The second line of input will contain two space-separated integers and . represents the number of shell right halves, while represents the number of left halves. It is guaranteed that the valves left are valid.
The next line will contain space-separated integers, the list of right-half shell GUIDs.
The last line of input will contain space-separated integers, the list of left-half shell GUIDs.

#### Output Specification

The number of shells that were either partially or fully lost.

#### Sample Input

10
4 3
1 2 8 4
1 8 5

#### Sample Output

8

#### Explanation

The only shells that survived were and . Part of , and were recovered, but they're incomplete. Aside from these, of the original shells are fully unaccounted for. Therefore, shells were destroyed.