#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ull unsigned long long
#define M 1000000007
#define N (1<<18)
#define P complex<long long>
#define X real()
#define Y imag()
using namespace std;
int n, f;
ll ans;
vector<int> v, vv;
int main() {
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(0);
cin >> n;
for(int i=0; i<n; i++) {
cin >> f;
v.push_back(f);
}
for(int i=0; i<n; i++) {
cin >> f;
vv.push_back(f);
}
sort(v.begin(), v.end());
sort(vv.begin(), vv.end());
for(int i=0; i<n; i++)
ans += abs(v[i]-vv[i]);
cout << ans;
}