Array Matching#12302

Array Matching

2 seconds
256 megabytes
Hard

You're given two arrays both of size , you must do the following operation exactly once:

Determine the maximum possible number of indices where a_i=b_i holds true after doing the operation.

Input

The first line of the input contains an integer (1 \le t \le 2\cdot10^5) the number of testcases.

The description for the test cases follows.

The first line of each test case contains a single integer (1 \le n \le 2\cdot10^5) the size of the array .

The second line of each test case contains integers a_1 , a_2 , ... , a_n (0 \le a_i \le n) the elements of the array .

The third line of each test case contains integers b_1 , b_2 , ... , b_n (0 \le b_i \le n) the elements of the array .

It is guaranteed that the sum of over all test cases does not exceed 2\cdot10^5.

Output

For each test case output a single integer, the maximum possible number of indices where a_i=b_i holds true after doing the operation.

Examples

Example 1

Loading
Loading

Note

For the first test case:

If we choose l=2,r=4,x=-1 the resulting array is 1,2,1,3, there's indices where and match, so the answer is , it can be shown that there's no better answer.

For the third test case:

If we choose l=1,r=5,x=2 the resulting array is 4,7,3,5,7, there's indices where and match, it can be shown that there's no way to get an answer bigger than so the final answer is .

Scoring

  • Subtask ( points): (\sum n \le 500)

  • Subtask ( points): (\sum n \le 5000)

  • Subtask ( points): (a_i \neq b_i)

  • Subtask ( points): no additional constraints