#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
    IOS;
    int n;
    cin >> n;
    vector<long long int> vec;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        vec.push_back(a);
    }
    long long first=0;
    for(int i=0; i<vec.size(); i++){
        first+=abs(vec[i]);
    }
    cout << first <<endl;
    double second=0;
    for(int i=0; i<vec.size(); i++){
        second+=pow(vec[i],2);
    }
    cout << setprecision(20)<<sqrt(second) <<endl;
    long long mx=INT32_MIN;
    for(int i=0; i<vec.size(); i++){
        mx = max(mx,abs(vec[i]));
    }
    cout << mx <<endl;
}
/*
*
*	AUTHOR :- @soham01
*		// "WORK HARD AND NEVER GIVE UP" //
*
*/
#include "bits/stdc++.h"

using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> //find_by_order(), order_of_key()
#define pb push_back
#define mp make_pair
#define vi vector<long long int >
#define vb vector<bool>
#define vs vector<string>
#define vd vector<double>
#define vvi vector<vector<long long int> >
#define vp vector<pair<long long int , long long int > >
#define seti set<long long int >
#define setc set<char>
#define setd set<double>
#define mod 1000000009
#define endl '\n'
typedef long long int lli;

// ITS MY REQUEST TO PLEASE PLEASE DO LOOK AT THE CONSTRAINS GIVEN CAREFULLY
// DO CHECK FOR CORNER CASES

/*-------LET THE GAME BEGIN-----------*/
lli power(lli x, lli y)
{
	lli temp;
	if ( y == 0)
		return 1;
	temp = power(x, y / 2);
	if (y % 2 == 0)
		return temp * temp;
	else
		return x * temp * temp;
}
const lli N = 1000005;
lli prime_arr[N + 1];
vector<lli> pr;

void sieve() {
	for (lli i = 2; i <= N; ++i) {
		if (prime_arr[i] == 0) {
			prime_arr[i] = i;
			pr.push_back (i);
		}
		for (lli j = 0; j < (lli)pr.size() && pr[j] <= prime_arr[i] && i * pr[j] <= N; ++j)
			prime_arr[i * pr[j]] = pr[j];
	}
}

void solve()
{
	lli n, i, j, c = 0, s = 0, f = 0;
	cin >> n;
	lli arr[n], brr[n];
	for (i = 0; i < n; i++)
	{
		cin >> arr[i];
	}
	for (i = 0; i < n; i++)
	{
		cin >> brr[i];
	}
	for (i = 1; i <= 1000; i++)
	{
		lli flag = 0;
		for (j = 0; j < n; j++)
		{
			if (arr[j] <= i and brr[j] >= i)
			{
				//cout << arr[j] << " " << i << " " << brr[j] << endl;
				if (brr[j] >= i) {
					flag = 1;
				} else {
					flag = 0;
					break;
				}
			} else {
				flag = 0;
				break;
			}
		}
		if (flag == 1) {
			//cout << i << endl;
			c++;
		}
	}
	cout << c << endl;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	/*lli t;
	cin >> t;
	while (t--)*/
//	sieve();
	solve();
	return 0;
}
/*
1
3 3
5 6 1
3 1 3
3 1 3
*/