#include<iostream>
using namespace std;
int main(){
long long A,B,C,D,E,AE,BE,CE,DE;
cin>>A>>B>>C>>D>>E;
AE=A-E;BE=B-E;CE=C-E;DE=D-E;
if(A==B&&A==C&&A==D&&B==C&&B==D&&C==D&&E==A&&E==B&&E==C&&E==D){
    cout<<4;
}else{
    if(( AE+BE+CE+BE)<=E ){
        cout<<1;
    }else{
        if((AE+BE+CE) <=E|| (AE+CE+DE) <=E||(CE+BE+DE)<=E||(AE+BE+DE)<=E){
            cout<<2;
        }else{
            if((AE+BE)<=E||(BE+DE)<=E||(DE+AE)<=E||(AE+DE)<=E||(CE+DE)<=E||(AE+CE)<=E||(BE+CE)<=E){
                cout<<3;
            }else{
                if(AE<=E||BE<=E||CE<=E||DE<=E){
                    cout<<4;
                    }
                }
            }
        }
}
return 0;
}
