CSES - HIIT Open 2019 - Differences
  • Time limit: 1.00 s
  • Memory limit: 512 MB

Given two arrays of n integers, your task is to permute the arrays so that the sum of pairwise differences is minimum.

Input

The first input line contains an integer n.

The second line has n integers a_1,a_2,\dots,a_n: the numbers in the first array.

The third line has n integers b_1,b_2,\dots,b_n: the numbers in the second array.

Output

Print one integer: the minimum sum of pairwise differences.

Constraints

  • 1 \le n \le 10^5
  • 1 \le a_i, b_i \le 10^9

Example

Input:

3
1 3 5
2 7 8

Output:

8

Explanation: An optimal solution is [3,1,5] and [8,2,7]. In this solution the sum is |3-8|+|1-2|+|5-7|=8.