#include "bits/stdc++.h"
#define puba push_back
#define mapa make_pair
#define ff first
#define ss second
#define bend(_x) (_x).begin(), (_x).end()
#define szof(_x) ((int) (_x).size())

using namespace std;
typedef long long ll;
typedef double dbl;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <long long, long long> pll;

int a, b, c, d, e;

int main() {    
    freopen("stars.in", "r", stdin);
    freopen("stars.out", "w", stdout);

    cin >> a >> b >> c >> d >> e;

    int tmp = c - b - 1;
    if (tmp > 0) {
        c -= tmp;
        d -= tmp;
        e -= tmp;
    }

    //cerr << d - 1 << " " << c - e - a << endl;

    cout << d - 1 + c - e - a << " ";

    cout << b - a + 1 - 2 + (d == e) << endl;

    return 0;
}