Symmetric Difference

Interview

Time limit2sMemory limit256 MB

Summary
Given two sets of natural numbers, compute the size of their symmetric difference.
Level

Easy3 of 10

Topics
Hash map, Array, Sorting
Solved
No attempts yet

Problem

There are two non-empty sets A and B whose elements are natural numbers. The symmetric difference of two sets is the union of A - B and B - A. In other words, it is the set of elements that belong to exactly one of the two sets.

Given sets A and B, find the number of elements in their symmetric difference.

For example, if A = {1, 2, 4} and B = {2, 3, 4, 5, 6}, then A - B = {1} and B - A = {3, 5, 6}, so the symmetric difference contains 4 elements.

Input

The first line contains the number of elements in set A and the number of elements in set B, separated by a space.

The second line contains all elements of set A, and the third line contains all elements of set B, each separated by spaces.

Each set has at most 200,000 elements, and every element is a natural number not greater than 100,000,000.

Output

Print the number of elements in the symmetric difference of the two sets.

Examples1

  1. Example 1

    Input
    3 5
    1 2 4
    2 3 4 5 6
    
    Expected output
    4