include [HTML_REMOVED]
using namespace std;
const int N = 1e5 + 3;
int a[N], b[N];
void batch_add(int l, int r, int c) {
b[l] += c, b[r + 1] -= c;
}
int main() {
int n; cin >> n;
for (int i = 1; i <= n; i ++) cin >> a[i];
for (int i = 1; i <= n; i ++) {
int t; cin >> t;
a[i] -= t;
}
for (int i = 1; i <= n; i ++) batch_add(i, i, a[i]);
int s = 0, t = 0;
for (int i = 1; i <= n; i ++) {
if (b[i] > 0) s += b[i];
else if (b[i] < 0) t -= b[i];
}
cout << max(s, t) << '\n';
return 0;
}