#include<iostream>
using namespace std;
int main(){
int A, B, C, D, E;
cin>>A>>B>>C>>D>>E;
int packets=4;
if(A<B){
    packets--;
}
if(B<C){
    packets--;
}
if(C<D){
    packets--;
}
if(A==B&&2*A<=C&&packets>1){
    packets--;
}
if(C==B&&2*C<=D&&packets>1){
    packets--;
}
if(C==D&&2*D<=E&&packets>1){
    packets--;
}
if(A==B&&3*A<=C&&packets>1){
    packets--;
}
if(C==B&&3*C<=D&&packets>1){
    packets--;
}
if(C==D&&3*D<=E&&packets>1){
    packets--;}

if(A==B&&4*A<=C&&packets>1){
    packets--;
}
if(C==B&&4*C<=D&&packets>1){
    packets--;
}
if(C==D&&4*D<=E&&packets>1){
    packets--;
}
cout<<packets;
return 0;
}