Skip to main content

Morgan Stanley

Morgan Stanley OA-5 2022

Problem Description

You are given two lists of positive integers. Write an algorithm to calculate the number of elements that are not common between the two lists.

Input Format

  1. The first line of the input consists of an integer, listinput1_size, representing the number of elements in the first list (N).
  2. The second line consists of (N) space-separated integers representing the first list of positive integers.
  3. The third line consists of an integer, listinput2_size, representing the number of elements in the second list (M).
  4. The fourth line consists of (M) space-separated integers representing the second list of positive integers.

Output Format

  • Print a positive integer representing the count of elements that are not common between both lists.

Constraints

  • 1 <= listinput1_size,listinput2_size<= 1000
  • All integers in the lists are positive.

Example

Input

11
1 1 2 3 4 5 5 7 6 9 10
10
11 12 13 4 5 6 7 18 19 20

Output

12

Explanation

  • The common elements between the two lists are: 4, 5, 6, 7.
  • The elements that are not common in both lists are: ([1, 1, 2, 3, 9, 10, 11, 12, 13, 18, 19, 20]).
  • The number of elements that are not common between the two lists is (12).