#include <bits/stdc++.h>
#define long long long int
using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);

    vector<int> a(4);
    for (int i = 0; i < 4; i++) cin >> a[i];
    int b;
    cin >> b;
    sort(a.begin(), a.end());
    if (a[0] == a[3]) {
        cout << 1;
    } else {
        a[0] += b;
        sort(a.begin(), a.end());
        if (a[0] == a[3]) {
            cout << 1;
        } else {
            cout << 0;
        }
    }

    return 0;
}