There are N mountains ranging from east to west, and an ocean to the west.
At the top of each mountain, there is an inn. You have decided to choose where to stay from these inns.
The height of the i-th mountain from the west is H_i.
You can certainly see the ocean from the inn at the top of the westmost mountain.
For the inn at the top of the i-th mountain from the west (i = 2, 3, ..., N), you can see the ocean if and only if H_1 \leq H_i, H_2 \leq H_i, ..., and H_{i-1} \leq H_i.
From how many of these N inns can you see the ocean?

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 20
 - 1 \leq H_i \leq 100

-----Input-----
Input is given from Standard Input in the following format:
N
H_1 H_2 ... H_N

-----Output-----
Print the number of inns from which you can see the ocean.

-----Sample Input-----
4
6 5 6 8

-----Sample Output-----
3

You can see the ocean from the first, third and fourth inns from the west.

Difficulty: introductory

Starter code:

Solutions:
N = int(input())
H = list(map(int,input().split()))

top = H[0]
cnt = 1

for i in range(1,N):
  if top <= H[i]:
    cnt += 1
    top = H[i]

print(cnt)

N = int(input())
H = list(map(int, input().split()))
 
ans = 0
for i in range(N):
  flag = True
  for j in range(i):
    if H[j] > H[i]: flag = False
  if flag: ans += 1
    
print(ans)

n = int(input())
h = list(map(int, input().split()))

x = 1
ans = h[0]

for i in range(1, n):
    if h[i] >= ans:
        x = x + 1
        ans = h[i]

print(x)

N = int(input())
H = list(map(int,input().split()))

h = 1
yama = []
yama.append(H[0])

while h <= N - 1:
    if max(H[:h]) <= H[h]:
        yama.append(H[h])
    h += 1

print(len(yama))

n = int(input())
h = list(map(int, input().split()))

a = h[0]
ans = 0
for i in h:
    if i >= a:
        ans += 1
        a = i
print(ans)

N = int(input())
H = list(map(int, input().split()))

count = N
for i in range(N - 1):
    j = -1 - i
    if H[j] < max(H[:j]):
        count -= 1

print(count)

N = int(input())
H = list(map(int,input().split()))

ans = 0
h = H[0]
for i in H:
	if h <= i :
		ans += 1
		h = i

print(ans)


N = int(input())
H = list(map(int, input().split()))

max_height = 0
count = 0
for h in H:
    if h >= max_height:
        max_height = h
        count += 1
print(count)

n = int(input())
li = list(map(int,input().split()))
cnt = 0
min = li[0]
for i in li:
    if i >= min:
        cnt += 1
        min = i
    
print(cnt)

n = int(input())
h = list(map(int, input().split()))
count = 0
m = 0
for i in range(0, n):
  if i == 0:
    count += 1
    m = h[i]
  else:
    if h[i] >= m:
      count += 1
      m = h[i]
print(count)

n=int(input())
h=list(map(int,input().split()))
kei = 1
m=h[0]
for i in range(1,n):
    if m <= h[i]:
        m = h[i]
        kei += 1

print(kei)

A=int(input())
l=list(map(int,input().split()))
ans=0
f=0
for i in l:
   if f<=i:
      f=i
      ans+=1
print(ans)

N=int(input())
H=list(map(int,input().split()))
x=1
for i in range(N):
    for j in range(i):
        if H[i]<H[j]:
            break
        if j==i-1:
            x+=1
print(x)

N = int(input())
height = list(map(int, input().split()))

count = 1
max_height = height[0]

for i in range(1, N):
    if height[i] >= max_height:
        max_height = height[i]
        count += 1

print(count)


n = int(input())
mountains = list(map(int, input().split()))

total = 0
mountains_current = []
for i in range(n):
    mountains_current.append(mountains[i])
    if mountains[i] >= max(mountains_current):
        total += 1

print(total)


n=int(input())
x =list(map(int, input().split()))

q=0
p=0
for i in range(n):
  for j in range(i):
    if i>j:
      if x[i]-x[j]>=0:
        q+=1
      else:
        q=0
        break
  if q>0:
    p+=1
    q=0

print((1+p))
        


mountain_number = input()
mountain_height = map(int, input().split())
observable_inn = observable_height = 0
for i in mountain_height:
    if i >= observable_height:
        observable_height = i
        observable_inn += 1
print(observable_inn)

n=int(input())
h=list(map(int,input().split()))
ans=1
for i in range(1,n):
    for j in range(0,i):
        if h[i]-h[j]<0:
            break
    else:
        ans+=1
print(ans)

N=int(input())
H=list(map(int,input().split()))
temp=0
ans=0
for i in range(N):
    if temp<=H[i]:
        ans+=1
        temp=H[i]
print(ans)


n=int(input())

h=list(map(int,input().split()))
cnt=0
max=0
for i in range(n):
    if max<=h[i]:
        cnt+=1
        max=h[i]

print(cnt)

# 数値の取得
N = int(input())
Hlist = list(map(int, input().split()))

# 最小値の取得と出力
Vcnt = 0
for cnt in range(0,N,1):
    maxH = max(Hlist[:cnt+1])
    if Hlist[cnt] >= maxH:
        Vcnt += 1

print(Vcnt)

n=int(input())
a=list(map(int,input().split()))

h_max=a[0]
r=1
for ii in range(1,len(a)):
  if h_max<=a[ii]:
    r+=1
    h_max=a[ii]
print(r)


N = int(input())
H = list(map(int, input().split()))
 
ans = 0
for i in range(N):
  flag = True
  for j in range(i):
    if H[j] > H[i]:
      flag = False
      break
  if flag: ans += 1
    
print(ans)

N = int(input())
H = list(map(int,input().split()))

max_h = 0
cnt = 0
for i in range(N):
  if H[i] >= max_h:
    max_h = H[i]
    cnt += 1

print(cnt)


# B - Great Ocean View

# 各山頂にあるN個の旅館のうち、海が見える旅館はいくつか

N = int(input())
H = list(map(int, input().split()))

answer = 0
height = H[0]

for i in H:
    if i >= height:
        answer += 1

    height = max(i,height)

print(answer)

# ABC124
# B Great Ocean View
n = int(input())
H = list(map(int, input().split()))
high = H[0]
ct = 1
for i in range(1,n):
    if high <= H[i]:
        ct += 1
        high = H[i]
print(ct)


N = int(input())
H = list(map(int, input().split()))
print(sum(H[i] >= max(H[:i] + [0]) for i in range(N)))

N = int(input())
H = list(map(int, input().split()))

cnt = 0
max_ = 0
for h in H:
    if h >= max_:
        cnt += 1
        max_ = h

print(cnt)


N = int(input())
H = list(map(int, input().split()))
ans = 0
for i in range(N):
    flg = True
    for j in range(i):
        if H[j] > H[i]:
            flg = False
            break
    
    if flg:
        ans += 1

print(ans)

n = int(input())
h = [int(s) for s in input().split()]
highest = h[0]
ans = 1
for i in range(1, n):
    if h[i] >= highest:
        ans += 1
        highest = h[i]
print(ans)


n = int(input())
h = list(map(int, input().split()))
ans = 0
a = 0
for i in range(n):
    if a <= h[i]:
        ans += 1
    if a < h[i]:
        a = h[i]
print(ans)

N = int(input())
H = list(map(int, input().split()))
ans = 0
maxH = 0
for i in H:
  if maxH <= i:
    ans += 1
    maxH = i
print(ans)


N = int(input())
H = list(map(int, input().split()))

c = 1
h = H[0]

for i in range(1, N):
  if h <= H[i]:
    h = H[i]
    c = c + 1
    
print(c)

N = int(input())
H = list(map(int,input().split()))

h_list = [H[0]]
cnt = 1
for i in range(1, N):
    h_list.append(H[i])
    # print(h_list)
    # print(H[i])
    if max(h_list) == H[i]:
        cnt += 1
print(cnt)

N = int(input())
H = list(map(int, input().split()))
count = 1
for i in range(1, N):
  k = N - i
  temp = H[k]
  del H[-1]
  if temp >= max(H):
    count += 1
print(count)

N = int(input())
H = list(map(int, input().split()))

count = N
for i in range(N - 1):
    j = -1 - i
    if H[j] < max(H[:j]):
        count -= 1

print(count)

n=int(input())
H=list(map(int,input().split()))
h=0
ans=0
for i in range(n):
  if H[i]>=h:
    ans+=1
  h=max(h,H[i])
print(ans)

n = int(input())
ans = prev = 0
for h in map(int, input().split()):
    if prev <= h:
        ans += 1
        prev = h
print(ans)


n = int(input())
q = list(map(int,input().split()))
m = 0
cnt = 0
for i in range(n):
  if m <= q[i]:
    cnt += 1
  m = max(q[i],m)
  
print(cnt)

n = int(input())
heights = list(map(int, input().split()))

cnt = 1
max = heights[0]
for p in range(n):
    if p == 0:
        continue
    else:
        if max <= heights[p]:
            max = heights[p]
            cnt += 1

print(cnt)

N = int(input())
H = list(map(int, input().split()))
ans = 0
mx = H[0]
for h in H:
    if h >= mx:
        ans += 1
    mx = max(h, mx)
print(ans)

n = int(input())
h = list(map(int, input().split()))

ans = 0

for i in range(n):
    h_list = h[0:i+1]
    highest = max(h_list)
    if highest <= h[i]:
        ans = ans + 1

print(ans)

n = int(input())
h = list(map(int,input().split()))
a = 0
count = 0
for i in range(n):
  if h[i] >= a:
    a = h[i]
    count += 1

print(count)

N = int(input())
H = map(int,input().split())
height_list = list(H)
# print(height_list)
Inn = []
Ocean_view = []

# Ocean_view.append(height_list[0])
i=0
for j in range(N):
    Inn.append(height_list[i])
    if height_list[i] == max(Inn):
        Ocean_view.append(height_list[i])

    i += 1

print(len(Ocean_view))

n = int(input())
a = list(map(int, input().split()))
s, t = 0, 0
for i in a:
  if i >= s:
    s = i
    t += 1
print(t)

#!/usr/bin/env python3

# input = stdin.readline



def main():
  N = int(input())
  h = list(map(int,input().split()))
  highest = 0
  res = 0
  for i in range(N):
    if h[i] >= highest:
      res += 1
      highest = h[i]
  print(res)
  return

def __starting_point():
  main()

__starting_point()

n = int(input())
hi = list(map(int, input().split()))
ans = [hi[0]]
hi0 = hi[0]
for i in hi[1:]:
    if hi0 <= i:
        ans.append(i)
        hi0 = max(hi0, i)

print(len(ans))

n = int(input())
h = list(map(int, input().split()))

ans = 1
for i in range(1, len(h)):
    if h[i] >= max(h[:i]):
        ans += 1
print(ans)

N = int(input())
H = list(map(int,input().split()))
ans = 0
for i in range(N):
    for j in range(0,i):
        if H[j] > H[i]:
            ans -= 1
            break
    ans += 1
print(ans)

n=int(input())
h=[int(i) for i in input().split()]

count=1

for i in range(1,n):
    if h[i]>=max(h[:i]):
        count+=1
        
print(count)


N = int(input())
hotel = list(map(int, input().split()))
i = 0
j = 0
cnt = 0
for i in range(N):
  q = 1
  for j in range(i):
    q = 0
    if hotel[j] > hotel[i]: break
    else:
      q = 1
  if q == 1:
    cnt += 1
print(cnt)

N = int(input())
H = list(map(int, input().split()))
ans = 0
mx = H[0]
for h in H:
    if h >= mx:
        ans += 1
    mx = max(h, mx)
print(ans)

n = int(input())
list_h = [int(i) for i in input().split()]
count = 0
max = 0
for i in range(0, n):
    if list_h[i] >= max:
        count += 1
        max = list_h[i]
print(count)

n = int(input())
h = list(map(int,input().split()))

ans = 1
max = h[0]
for i in range(1,n) :
    if h[i] >= max :
        max = h[i]
        ans += 1
print(ans)


N = int(input())
H = list(map(int, input().split()))
maxi = 0
ans = 0
for i in range(N): 
    if H[i] >= maxi:
        ans += 1
        maxi = H[i]
print(ans)

n = int(input())
h = list(map(int,input().split()))
ans = 1
hi = h[0]
for i in range(1,n):
  if h[i] >= hi:
    ans += 1
    hi = h[i]
print(ans)

N = int(input())
H = list(map(int, input().split()))
maximum = H[0]
cnt = 1

for i in range(1,N):
    if H[i] >= maximum:
        maximum = H[i]
        cnt += 1
print(cnt)



a=int(input())
b=list(map(int,input().split()))
c=0
d=0
for i in range(a):
  if c<=b[i]:
    c=b[i]
    d=d+1
print(d)

a = int(input())
b = list(map(int,input().split()))
c = 0
ans = 0
for i in range(a):
  if b[i] >= c:
    ans += 1
  c = max(c,b[i])
print(ans)



# abc124b
# https://atcoder.jp/contests/abc124/tasks/abc124_b

# 東西にN個の山がある
# 西からi番目の山の高さはHi
# 西からi番目の山頂にある旅館からは必ず海が見れる
# 西からi(i=2, 3,...,N)番目の山頂にある旅館については、
# H1<Hi、H2<Hi...かつHi-1<Hiのとき、海が見れる

# N子の旅館のうち、海がみられるのは何個か

# max:最大値を求める関数

# 入力
n = int(input())
h = list(map(int, input().split()))

# 処理
# 山の高さを格納する
h_list = [h[0]]
# 海が見える旅館のカウント
ans = 1

for i in range(1, n):
    h_list.append(h[i])
    # 既存のリストの最大値の山の高さ以上の時
    if h[i] >= max(h_list):
        # 海が見える旅館の数を加算
        ans += 1

print(ans)



N = int(input())
H = list(map(int,input().split()))
highest = H[0]
ans = 0

for i in range(N):
    if highest <= H[i]:
        highest = H[i]
        ans +=1

print(ans)

# B - Great Ocean View
# https://atcoder.jp/contests/abc124/tasks/abc124_b

n = int(input())
h = list(map(int, input().split()))

cnt = 1
wk = h[0]

for i in range(n - 1):
    if wk <= h[i + 1]:
        cnt += 1
        wk = h[i + 1]

print(cnt)


N = input()
H = map(int, input().split())

num = 0
ans = 0

for i in H:
    if num <= i:
        ans += 1
        num = i
print(ans)

n=int(input())
h=list(map(int, input().split()))
count=0
for i in range(n):
  check=True
  for j in range(i):
    if h[j]>h[i]:
      check=False
  if check:
    count+=1
print(count)

N = int(input())
H = map(int, input().split())

ans = 0
num = 0
for i in H:
    if num <= i:
       ans += 1
       num = i

print(ans)

n = int(input())
hl = list(map(int, input().split()))
cnt = 0
hmax = 0
for h in hl:
    if hmax <= h:
        hmax = h
        cnt += 1

print(cnt)

N = int(input())
ls = list(map(int,input().split()))
m = 0
ii = 0
for i in range(N):
    if m <= ls[i]:
        ii += 1
        m = ls[i]
    else:
        continue
print(ii)

n = int(input())
h = list(map(int, input().split()))
ans = 0
maxh = 0
for i in range(n):
    if h[i] >= maxh:
        ans += 1
        maxh = h[i]
print(ans)

n = int(input())
data = list(map(int,input().split()))
ans = 1

for  i in range(1,n):
    if all(data[i] >= j for j in data[0:i]):
        ans += 1
print(ans)

def main():
    sea = 1
    n = int(input())
    h = list(map(int, input().split()))
    mountain = h[0]
    for i in range(1, n):
        if mountain <= h[i]:
            sea += 1
            mountain = h[i]
    print(sea)


def __starting_point():
    main()

__starting_point()

n = int(input())
h = list(map(int, input().split()))
ans = 0
highest = h[0]
for i in range(n):
  if highest <= h[i]:
    ans += 1
    highest = h[i]
print(ans)

N = int(input())
H = list(map(int,input().split()))
ans = 1

for i in range(1,N):
    # print(H[:i+1])
    if max(H[:i+1]) == H[i]:
        ans += 1

print(ans)

N=int(input())
H=list(map(int, input().split()))

ans=1
Hbefore=H[0]

for i in range(1,N):
	if H[i]>=Hbefore:
		ans+=1
	
	Hbefore=max(Hbefore,H[i])

print(ans)

n = int(input())
a = list(map(int, input().split()))
cont = 1
h = a[0]

for i in range(1, n):
    if a[i]>=h:
        h = a[i]
        cont += 1

print(cont)


N = int(input())
H = list(map(int, input().split()))

result = 1
H_high = H[0]

for i in range(1, N):
    if H[i] >= H_high and H[i] >= H[i - 1]:
        result += 1
        H_high = H[i]

print(result)

n = int(input())
h = list(map(int, input().split()))

ans = 0
highest = 0
for height in h:
    highest = max(height, highest)
    if height >= highest:
        ans += 1

print(ans)



N = int(input())
H = list(map(int,input().split()))

h_list = [H[0]]
cnt = 1
for i in range(1, N):
    h_list.append(H[i])
    
    if max(h_list) == H[i]:
        cnt += 1
print(cnt)



n = int(input())
h = list(map(int, input().split()))
a = h[0]
b = 0
for i in h:
    if i >= a:
        a = i
        b += 1
print(b)

from typing import List


def answer(n: int, h: List[int]) -> int:
    count = 0
    highest = 0
    for mountain in h:
        if highest <= mountain:
            highest = mountain
            count += 1

    return count


def main():
    n = int(input())
    h = list(map(int, input().split()))
    print((answer(n, h)))


def __starting_point():
    main()

__starting_point()

def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def calc(i, h):
    return all(h[i] >= h[j] for j in range(i))


def main():
    n = int(input())
    h = Input()
    ans = 1
    for i in range(1, n):
        ans += calc(i, h)
    print(ans)


main()

n = int(input())
a = [int(x) for x in input().split()]

result = 0
for i, x in enumerate(a):
  flg = True
  
  for c in a[:i]:
    flg = flg and c <= x
  
  if flg:
    result += 1

print(result)

N = int(input())
H = list(map(int, input().split()))
result = 1 # 先頭の+1

H.reverse() # 計算しやすいように並び変える
HH = H.copy()

for i in H:
    HH.remove(i)

    if len(HH) == 0:
        break

    for ii in HH:
        if i < ii:
            break
    else:
        #print(i)
        result += 1


print(result)

n = int(input())
h = list(map(int,input().split()))
hi = h[0]
ans = 1
for i in range(1,n):
  if h[i] >= hi:
    ans += 1
    hi = h[i]
print(ans)

def main():
    see_sea = 1
    n = int(input())
    h = list(map(int, input().split()))
    mountain = h[0]
    for i in range(1, n):
        if mountain <= h[i]:
            see_sea += 1
            mountain = h[i]
    print(see_sea)


def __starting_point():
    main()

__starting_point()

n = int(input())
h = list(map(int,input().split()))
c = 0
d = 0
for i in range(n):
    if h[i] >= d:
        c+=1
        d = h[i]
print(c)

n=int(input())
H=list(map(int,input().split()))
ans=0
m=-1000
for i in range(n):
  if m<=H[i]:
    m=H[i]
    ans+=1
print(ans)

N=int(input())
H=list(map(int,input().split()))
ans=0
h=0
for i in range(N):
    if H[i]>=h:
        ans+=1
        h=H[i]
print(ans)


n = int(input())
h = list(map(int, input().split()))
res = 1
h_max = h[0]
for i in range(1, len(h)):
    if h[i] >= h_max:
        res += 1
        h_max = h[i]
print(res)


N = int(input())
H = list(map(int, input().split()))

h_list = [H[0]]
cnt = 1
for i in range(1, N):
    h_list.append(H[i])

    if max(h_list) == H[i]:
        cnt += 1
print(cnt)

n = int(input())
L = list(map(int,input().split()))
m = 0
cnt = 0
for l in L:
  if m <= l:
    m = l
    cnt += 1
print(cnt)
  


n = int(input())
h = list(map(int, input().split()))
view1 = h[0]
view = 0
c = 1
for i in range(1, n):
    if view1 <= h[i] and view <= h[i]:
        c += 1
    view = max(view, h[i])
print(c)

n = int(input())
h = list(map(int,input().split()))
num = 0
ans = 0
for i in h:
  if num <= i:
    ans += 1
    num = i
print(ans)

def view_check(n: int, heights: list) -> int:
    cnt = 1
    max_height = heights[0]
    for i in range(1, n):
        if heights[i] >= max_height:
            cnt += 1
            max_height = heights[i]
    return cnt

def __starting_point():
    n=int(input())
    heights=list(map(int,input().split()))
    print((view_check(n,heights)))


__starting_point()

# coding: utf-8

num = int(input())
str = input().split()
table = [int(i) for i in str]
count = 1
maxi = table[0]
pointed = table[0]
for i in range(1, num):
    if maxi <= table[i]:
        maxi = table[i]
        count += 1
print(count)


N = int(input())
N_List = list(map(int,input().split()))
ans = 1
maxN = N_List[0]
for i in range(1,N):
    if N_List[i]>=maxN:
        ans += 1
        maxN = N_List[i]
print(ans)

n = int(input())
h = list(map(int,input().split()))
num = 0
ans = 0
for i in h:
  if num <= i:
    ans += 1
    num = i
print(ans)

n = int(input())
h = list(map(int, input().split()))

def answer(n: int, h: list) -> int:
    h_list = 0
    answer = 0
    for i in h:
        if h_list <= i:
            answer += 1
        h_list = max(h_list, i)
    return answer

print(answer(n, h))

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

for i in reversed(list(range(1, n))):
    m = H[i]
    for j in range(0, i):
        if H[j] <= m:
            cnt[i] += 1
        else:
            break

ans = 0
for i in range(n):
    if cnt[i] == i:
        ans += 1
#print(cnt)
print(ans)                      


N = int(input())
H = list(map(int, input().split()))

ans = [1 for i in range(N)]
for i in range(1, N):
  for j in range(i):
    if H[j] > H[i]:
      ans[i] = 0
print(sum(ans))

n = int(input())
h = [int(x) for x in input().split()]

cnt = 1

for i in range(1,n):
    for j in range(i):
        if(h[i]<h[j]):
            break
        if(j==(i-1)):
            cnt += 1

print(cnt)