Compatible friends
##### Submissions: 567   Accuracy: 27.12%   Difficulty: Easy   Marks: 2

Suppose there are two friends and now they want to test their friendship that how much compatible they are. Given the numbers n numbered from 1 to n and they are asked to rank the numbers. The task is find the compatibility difference between them. Compatibility difference is the number of mis-matches in the relative ranking of the same movie given by them.

```Input : a1[] = {3, 1, 2, 4, 5}
a2[] = {3, 2, 4, 1, 5}
Output : 2
Explanation : Compatibility difference is two
because first ranks movie 1 before 2 and 4 but
other ranks it after.

Input : a1[] = {5, 3, 1, 2, 4}
a2[] = {3, 1, 2, 4, 5}
Output : 5
Total difference is four due to mis-match in
position of 5```

Input:
First line consists of T test cases. First line of every test case consists of N, denoting number of array elements. Second and third line respectively consists of A1 and A2 array.

Output:
Single line output, print the required answer.

Constraints:
1<=T<=100
1<=N<=1000

Example:
Input:

1
5
3 1 2 4 5
3 2 4 1 5
Output:
2

#### ** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Saksham Raj Seth
Author: saksham seth

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.