Submission

Status:
[PPPP][P][P][P][P]

Score: 100

User: sorawit

Problemset: นก

Language: python

Time: 0.025 second

Submitted On: 2025-04-18 13:56:27

n = int(input())
H = list(map(int, input().split()))
cnt = 0

if n == 1:
    print(1)
else:
    for i in range(n):
        if i == 0:
            if H[i + 1] < H[i]:
                cnt += 1
        elif i == n - 1:
            if H[i - 1] < H[i]:
                cnt += 1
        else:
            if H[i - 1] < H[i] and H[i + 1] < H[i]:
                cnt += 1
    print(cnt)