#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
#define pri(str) cout << str << endl
using ll = long long;
using P = pair<int, int>;

const ll MX = 1e18;
const long double PI = acos(-1);

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}


int main()
{
    int n;
    cin >> n;
    int l = 0;
    int r = 1005;
    
    rep(i,n)    
    {
        int a;
        cin >> a;
        if(l < a)
            l = a;
    }

    rep(i,n)    
    {
        int a;
        cin >> a;
        if(a < r)
            r = a;
    }

    if( r-l < 0 )
        pri(0);
    else
        pri(r-l+1);
    
    return 0;
}
// *** Though I am not John Snow, yet I know nothing ***
#include <bits/stdc++.h>
using namespace std;
#define F(i, a, b) for (int i = a; i < b; i++)
#define ff first
#define ss second
#define int long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int, int>
#define vi vector<int>
#define mii map<int, int>
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define mk(arr, n, type) type *arr = new type[n];
#define range(a, b) substr(a, b - a + 1)
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define FIO                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)

void solve()
{
    string s;
    cin >> s;
    string ans;
    int i = 0, n = s.size();
    while (i < n && s[i] != '.')
    {
        ans.push_back(s[i]);
        i++;
    }
    cout << ans;
}

int32_t main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    FIO;

    solve();

    return 0;
}