#include <bits/stdc++.h>

using namespace std;

int main() {

    map<int, int> mp;
    int N;
    cin >> N;

    vector<int> v(N);
    vector<int> c(N);
    for (int i = 0; i < N; i++) {
        cin >> v[i];
    }

    for (int i = 0; i < N; i++) {
        cin >> c[i];
    }

    for (int i = 0; i < N; i++)
        mp[v[i]] = c[i];

    int m, n;
    m = n = 0;
    int sumX = 0, sumY = 0;
    for (map<int, int>::iterator it = mp.begin(); it != mp.end(); ++it) {
        if (it->first >= it->second) {
            sumX += it->first;
            sumY += it->second;
        }
    }
    cout << sumX - sumY << '\n';
    return 0;
}
