#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
#include <bitset>
#include <queue>

using namespace std;

#define ll long long
#define MOD 1000000007
#define rep(i, n) for( int i = 0; i < (n); i++ )

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a.at(i);

    bool ans = true;

    sort( a.begin(), a.end () );
    rep(i, n){
        if( a.at(i) != i + 1 ){
            ans = false;
        }
    }

    if( ans ){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

    return 0;
}

#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    for(int i = 0; i < N; i++)cin >> A[i];
    for(int i = 0; i < N; i++)cin >> B[i];
    
    int  Bmin = 10000, Amax = 0;
    
    for(int i = 0; i < N; i++){
        Bmin = min(B[i], Bmin); 
        
        //cout << Bmin << endl;
    }
    
    for(int i = 0; i < N; i++){
        Amax = max(A[i],Amax); 
    }
    
    int Ans = Bmin-Amax;
    
    //cout << Amax << Bmin;
    
    if(Ans < 0){
        cout << 0 << endl;
    }
    else{
        cout << Ans+1 << endl;
    }
    
}
