/*
    OBI 2026 - Fase 1
    Encontro
*/

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

const int maxn = 31; 

int main(){
    ios::sync_with_stdio(false); cin.tie(NULL); 
    vector<pair<int, int>> v(3); 
    for( auto &[a, b] : v ) cin >> a >> b; 

    int ans = 0; 
    for( int i = 1; i <= maxn; i++ ){
        bool ok = true; 
        for( auto [l, r] : v ) ok = ok && l <= i && i <= r; 
        ans += (int)ok;
    }

    cout << ans << endl;
}