#include <bits/stdc++.h>
#include <cassert>
typedef long long int ll;
using namespace std;
// #include <atcoder/all>
// using namespace atcoder;

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
  vector<ll> A(N), B(N);
  for (ll i = 0; i < N; i++) cin >> A[i];
  for (ll i = 0; i < N; i++) cin >> B[i];
  ll maxA = 0;
  ll minB = 1001;
  for (ll i = 0; i < N; i++) {
    maxA = max(A[i], maxA);
    minB = min(B[i], minB);
  }
  if (minB >= maxA) {
    cout << minB - maxA + 1 << endl;
  }else {
    cout << 0 << endl;
  }
  

  return 0;
}


#include <iostream>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <vector>
//#include "maybe.h"
#include <limits>
#include <bitset>
#include <queue>
#include <algorithm>
#include <list>
#include <cmath>
#include <cstring>
#include <bits/stdc++.h>

using namespace std;

using ull = unsigned long long;
using ll = long long;
using ui = unsigned int;
using PI = pair<int, int>;


void func() {
    int N;
    ll md = 0;
    ll cd = 0;
    ll ed_s = 0;
    cin >> N;
    for (int i = 0; i < N; i++) {
        ll x;
        cin >> x;
        md += abs(x);
        cd = max(cd, abs(ll(x)));
        ed_s += x * x;
    }
    double ed = sqrt(ed_s);
    cout << fixed << setprecision(15);

    cout << md << endl;
    cout << ed << endl;
    //printf("%.15f\n", ed);
    cout << cd << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    func();
    return 0;
}
