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

Given two arrays of nn 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 nn.

The second line has nn integers a1,a2,,ana_1,a_2,\dots,a_n: the numbers in the first array.

The third line has nn integers b1,b2,,bnb_1,b_2,\dots,b_n: the numbers in the second array.

Output

Print one integer: the minimum sum of pairwise differences.

Constraints

  • 1n1051 \le n \le 10^5
  • 1ai,bi1091 \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][3,1,5] and [8,2,7][8,2,7]. In this solution the sum is 38+12+57=8|3-8|+|1-2|+|5-7|=8.