#include <bits/stdc++.h>
int main(void) {
  int s[20], i, n, m, a;
  n = 0;
  m = 0;
  scanf("%d", &a);
  for (i = 0; i < 4; i++) {
    scanf("%d", &s[i]);
  }
  for (i = 0; i < 20; i++) {
    printf("i=%d,,,", i);
    if (s[i + 1] > 100) s[i + 1] = 0;
    if (s[m] <= s[i + 1]) {
      printf("sm=%dsi=%d,,", s[m], s[i + 1]);
      n = n + 1;
      m = m + 1;
      printf("n=%d,m=%d,,", n, m);
    }
  }
  if (n == 0) n = n + 1;
  printf("%d", n);
}
