#K40572. Minimum Operations to Make Sequences Identical

    ID: 26672 Type: Default 1000ms 256MiB

Minimum Operations to Make Sequences Identical

Minimum Operations to Make Sequences Identical

Given two sequences a and b of length n, determine the minimum number of operations required to make them identical. In one operation, you can change an element of either sequence so that it matches the corresponding element in the other sequence.

Formally, for sequences \( a = [a_1, a_2, \dots, a_n] \) and \( b = [b_1, b_2, \dots, b_n] \), the answer is given by the formula:

\[ \sum_{i=1}^{n} \mathbf{1}_{\{a_i \neq b_i\}}, \]

where \( \mathbf{1}_{\{a_i \neq b_i\}} \) is 1 if \( a_i \neq b_i \) and 0 otherwise.

The input will be provided via standard input with the following format:

  • The first line contains a single integer n, the number of elements in each sequence.
  • The second line contains n space-separated integers representing sequence a.
  • The third line contains n space-separated integers representing sequence b.

The output should be a single integer written to standard output representing the minimum number of operations required.

inputFormat

The input consists of three lines:

  1. An integer n (1 ≤ n ≤ 105), the number of elements in sequences a and b.
  2. n space-separated integers representing the elements of sequence a.
  3. n space-separated integers representing the elements of sequence b.

outputFormat

Output a single integer which is the minimum number of operations required to make the two sequences identical. This integer should be written to standard output.

## sample
6
1 2 3 4 5 6
6 5 4 3 2 1
6