#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=packets-1;
}
if(B<C){
    packets=packets-1;
}
if(C<D){
    packets=packets-1;
}
if(D==E&&packets!=4){
    packets=packets+1;
}
cout<<packets;
return 0;
}