Problem:


Score : 200 points

Problem Statement

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 1

4
6 5 6 8

Sample Output 1

3

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

Sample Input 2

5
4 5 3 5 4

Sample Output 2

3

Sample Input 3

5
9 5 6 8 4

Sample Output 3

1



Sample input:
4
6 5 6 8


Sample output:
3

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

max = h[0]
count = 0
for i in h:
    if max <= i:
        count += 1
        max = i
    else:
        continue
print(count)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# 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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
N= int(input())
A =list(map(int,input().rstrip().split(" ")))
ma = 0
ans = 0
for i in A:
    if i >= ma:
        ans += 1
        ma = i
print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
from heapq import heapify, heappop, heappush
import math
import random
import string
from copy import deepcopy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N = getN()
H = getList()
imos = deepcopy(H)
for i in range(1, N):
    imos[i] = max(imos[i - 1], H[i])

ans = 1 # 最初の一つは必ず景色を見れる
# ２番目以降について
for i in range(1, N):
    if H[i] >= imos[i - 1]:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    h_list = list(map(int, input().split()))
    highest = 0
    cnt = 0

    for h in h_list:
        if highest <= h:
            highest = h
            cnt += 1

    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
# 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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():

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

    print(count)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
H=[int(i) for i in input().split()]

lim=0
ans=0
for i in range(n):
    if H[i]>=lim:
         ans+=1
         lim=H[i]
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
ans=0
maxh=h[0]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
#!/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

if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
            
def bubble(inputlist):
    for i in range(len(inputlist)-1):
        if inputlist[i] > inputlist[-1]:
            return False
    return True
cnt = 0
for i in range(n):
    is_candidate = True
    for j in range(i):
        if h[j] > h[i]:
            is_candidate = False
            break
    if is_candidate:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *H = map(int, read().split())

    m = 0
    ans = 0
    for h in H:
        if h >= m:
            ans += 1
            m = h

    print(ans)
    return


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
h0 = 0
cnt = 0
for h in map(int, input().split()):
    if h >= h0:
       cnt += 1
       h0 = h
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)


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

max_h = 0

count = 0
for h in H:
    if h >= max_h:
        count += 1
    max_h = max(max_h, h)

print(count)

Submission status: Accepted

Solution code:
n=int(input())
H=list(map(int,input().split()))

c=1
maxh=H[0]
for i in range(1,len(H)):
    if maxh<=H[i]:
        c+=1
        maxh=H[i]
print(c)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
h = LI()
ans = 0
for i in range(n):
    x = h[i]
    for j in range(i):
        if x < h[j]:
            break
    else:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

c = 1
h_max = h[0]

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

print(c)

Submission status: Accepted

Solution code:
n=int(input())
h=list(map(int,input().split()))
x=[h[0]]
ans=1
for i in range(1,n):
    if h[i-1]<=h[i] and max(x)<=h[i]:
        ans+=1
    x.append(h[i])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

cnt=0
highest=H[0]

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

print(cnt)

Submission status: Accepted

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

c = 0

for i in range(n):
  t = True
  for j in range(i):
    if h[j] > h[i]:
      t = False
      break
  if t == True:
    c += 1
  t = True
print(c)

Submission status: Accepted

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

maxHeight = 0
count = 0
for i in range(N):
    if H[i] >= maxHeight:
        count += 1
        maxHeight = H[i]
print(count)

Submission status: Accepted

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

high = H[0]
ans = 0

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

print(ans)

Submission status: Accepted

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

ans = 1

for i in range(1, N):
    ans += max(H[0:i]) <= H[i]

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().strip().split()))

max_num = 0
res = 0
for num in a:
    if max_num <= num:
        max_num = num
        res += 1

print(res)

Submission status: Accepted

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

left = 0
ret = 0
for i in h:
    if i >= left:
        ret += 1
        left = i
print(ret)

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(int, input().split()))
ans = 0
for i in range(N):
    tf = True
    for j in range(0, i):
        if H[j] <= H[i]:
            pass
        else:
            tf = False
    if tf == True:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
count = 0
h = [int(s) for s in input().split()]
l = 0
for i in range(n):
    if h[l] <= h[i]:
        count += 1
        l = i
print(count)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

def main():
    N=ii()
    H=list(mi())

    ans = 0
    for i in range(N):
        h = H[i]
        for j in range(i):
            if H[j] > h:
                break
        else:
            ans += 1
            continue
            
        
       
    print(ans)


                





if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
h1 = h[0]
val = 0
count = 1
for i in h[1:]:
    if i >= val and i >= h1:
        count += 1
        val = i
    else:
        pass
print(count)

Submission status: Accepted

Solution code:
N = int(input())
h = list(map(int,input().split()))

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

print(ans)

Submission status: Accepted

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

hmax_rui = [0]*n
hmax_rui[0] = h[0]
for i in range(1,n):
    hmax_rui[i] = max(hmax_rui[i-1],h[i])

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

Submission status: Accepted

Solution code:
n=int(input())
*h,=map(int,input().split())
c=0
for i in range(n):
    if all(h[i]>=h[j] for j in range(i)):
        c+=1
print(c)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
a = 1
m = h[0]
# 西から最も高い場所にある旅館であれば、海を眺めることが出来る。
for i in range(1, n):
    m = max(h[i-1], m)
    if m <= h[i]:
        a += 1
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
H = list(map(lambda h: int(h), input().split(" ")))
M = 0
cnt = 0

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

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    H = LI()

    ans = 0
    m = 0
    for i in H:
        if i >= m:
            ans += 1
        m = max(i, m)

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    H = nl()
    ans = 0
    for i in range(n):
        for j in range(i):
            if H[j] > H[i]:
                break
        else:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
l = []
cnt = 0

for i in range(n):
    l.append(h[i])
    if h[i] == max(l):
        cnt += 1
        
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
'''     ░░█ ▄▀█ █   █▀ █░█ █▀█ █▀▀ █▀▀   █▀█ ▄▀█ █▀▄▀█  
        █▄█ █▀█ █   ▄█ █▀█ █▀▄ ██▄ ██▄   █▀▄ █▀█ █░▀░█     '''


# [temp1.py] => [29-07-2020 @ 10:25:10] 
# Author & Template by : Udit "luctivud" Gupta
# https://www.linkedin.com/in/udit-gupta-1b7863135/


import math;   from collections import *
import sys;    from functools import reduce
import time;   from itertools import groupby

# sys.setrecursionlimit(10**6)

def input()         : return sys.stdin.readline()
def get_ints()      : return map(int, input().strip().split())
def get_list()      : return list(get_ints())
def get_string()    : return list(input().strip().split())
def printxsp(*args) : return print(*args, end="")
def printsp(*args)  : return print(*args, end=" ")


DIRECTIONS = [(+0, +1), (+0, -1), (+1, +0), (+1, -1)] 
NEIGHBOURS = [(-1, -1), (-1, +0), (-1, +1), (+0, -1),\
              (+1, +1), (+1, +0), (+1, -1), (+0, +1)]


CAPS_ALPHABETS = {chr(i+ord('A')) : i for i in range(26)}
SMOL_ALPHABETS = {chr(i+ord('a')) : i for i in range(26)}
INF = float('inf')


# Custom input output is now piped through terminal commands.
# for _test_ in range(int(input())): 
n = int(input())
li =get_list()
max_so_far = -1
ans = 0
for i in li:
	if i >= max_so_far:
		ans += 1
	max_so_far = max(max_so_far, i)
print(ans)



# print("Time Elapsed: {}".format(float(S34p-S34t)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

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

ans = 0
vi = h[0]

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

Submission status: Accepted

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

res = 0
max_h = 0
for i in range(n):
    if h[i] >= max_h:
        res += 1
        max_h = h[i]
print(res)

Submission status: Accepted

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

cnt = 0
for i in range(2,N+1):
  if max(H[:i]) <= H[i-1]:
    cnt += 1
print(cnt+1)

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
mx = 0
cnt = 0
for i in h:
    mx = max(mx, i)
    if i==mx:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
h = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
N = int(input())
MM = input().split()
count1 = 0
for i in range(N):
  count2 = 0
  for j in range(i+1):
    if int(MM[i]) < int(MM[j]):
      count2 +=1
  if count2 == 0:
    count1 +=1
print(count1)

Submission status: Accepted

Solution code:
n=int(input());a=list(map(int,input().split()))[::-1]
result=0
for i in range(n):
  judge=True
  for j in range(i+1,n):
    if a[i]<a[j]:
      judge=False
      break
  if judge: result+=1
print(result)

Submission status: Accepted

Solution code:
n = int(input())
H = list(map(int, input().split()))

highest = 0
cnt = 0

for i in H:
    if i >= highest:
        highest = i
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
n = int(input())
h = list(map(int, input().split()))
ans = 1
mx = h[0]
for i in range(1, n):
    if h[i-1] <= h[i] and mx <= h[i]:
        ans += 1
    mx = max(mx, h[i])
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
data = list(map(int, input().split()))

ans = 1
max_ = data[0]
for i in range(1, n):
    if max_ <= data[i]:
        max_ = data[i]
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
count=0
for i in range(n):
    b.append(a[i])
    b=sorted(b)
    if b[i]==a[i]:
        count=count+1
    else:
        pass
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

MAX=H[0]
count=1
for i in range(1,N):
  if H[i]>=MAX:
    count += 1
    MAX = H[i]
print(count)

Submission status: Accepted

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

max_ = h[0]
res = 1
for i in range(1, n):
    if max_ <= h[i]:
        max_ = h[i]
        res += 1
print(res)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    H = list(map(int, input().split()))
    Highest = 0
    ac = 0
    for i in range(N):
        if Highest <= H[i]:
            ac += 1
            Highest = H[i]
    print(ac)
main()

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
h = [int(xi) for xi in input().split()]

h0 = 0
count = 0
for xi in range(n):
    if h0 <= h[xi]:
        count+=1
        h0=h[xi]

print(count)

Submission status: Accepted

Solution code:
# abc124_b.py
# https://atcoder.jp/contests/abc124/tasks/abc124_b

# B - Great Ocean View /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# 東西に N個の山が連なっており、西の果てには広大な海が広がっています。
# 各山頂には旅館があり、あなたは海を眺められる旅館を選ぶことにしました。
# 西から i番目の山の高さは Hiです。
# 西から 1番目の山頂にある旅館からは必ず海を眺めることができます。
# 西から i(i=2,3,...,N) 番目の山頂にある旅館については、H1≤Hi, H2≤Hi, ..., 
# かつ Hi−1≤Hiのとき、その旅館から海を眺めることができます。
# これら N個の旅館のうち、海を眺められる旅館はいくつあるでしょうか。

# 制約
#     入力は全て整数である。
#     1≤N≤20
#     1≤Hi≤100

# 入力
# 入力は以下の形式で標準入力から与えられる。
# N
# H1 H2 ... HN

# 出力
# 海を眺められる旅館の数を出力せよ。

# 入力例 1
# 4
# 6 5 6 8

# 出力例 1
# 3

# 西から 1,3,4番目の旅館から海を眺めることができます。

# 入力例 2
# 5
# 4 5 3 5 4

# 出力例 2
# 3

# 入力例 3
# 5
# 9 5 6 8 4

# 出力例 3
# 1


def log(line):
    if False:
        print(line)


def calculation(lines):
    # line = lines[0]
    N = int(lines[0])
    values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[1].split()))
    # values = list()
    # for i in range(6):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(Q):
    #     valueses.append(list(map(int, lines[i+1].split())))

    result = 0

    for i in range(N):
        if values[i] >= max(values[:i+1]):
            result += 1

    return [result]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['4', '6 5 6 8']
        lines_export = [3]
    if pattern == 2:
        lines_input = ['5', ' 4 5 3 5 4']
        lines_export = [3]
    if pattern == 3:
        lines_input = ['5', '9 5 6 8 4']
        lines_export = [1]
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    if len(args) == 1:
        mode = 0
    else:
        mode = int(args[1])
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N = I()
H = LI()
ans = 0
r = 0
for i in range(N):
    if H[i] >= r:
        ans += 1
        r = H[i]
print(ans)

Submission status: Accepted

Solution code:
_,*l=map(int,open(0).read().split())
m=c=0
for i in l:
  if m<=i: m=i; c+=1
print(c)

Submission status: Accepted

Solution code:
n=int(input())
l=map(int,input().split())
m=c=0
for i in l:
  if m<=i:
    m=i
    c+=1
print(c)