#include
int main(void) {
int cur, prev, next, ans;
prev = ans = 0;
std::cin >> next;
while (true) {
cur = next;
if (cur == 0) {
break;
}
std::cin >> next;
if ((prev == 0 || cur > prev) && (next == 0 || cur > next)) {
ans++;
}
prev = cur;
}
std::cout << ans << std::endl;<br> return 0;
}