Problem:


Score : 300 points

Problem Statement

Given is a permutation P_1, \ldots, P_N of 1, \ldots, N.
Find the number of integers i (1 \leq i \leq N) that satisfy the following condition:  

For any integer j (1 \leq j \leq i), P_i \leq P_j.

Constraints

1 \leq N \leq 2 \times 10^5

P_1, \ldots, P_N is a permutation of 1, \ldots, N.  

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
P_1 ... P_N

Output

Print the number of integers i that satisfy the condition.

Sample Input 1

5
4 2 5 1 3

Sample Output 1

3

i=1, 2, and 4 satisfy the condition, but i=3 does not - for example, P_i > P_j holds for j = 1.

Similarly, i=5 does not satisfy the condition, either. Thus, there are three integers that satisfy the condition.

Sample Input 2

4
4 3 2 1

Sample Output 2

4

All integers i (1 \leq i \leq N) satisfy the condition.

Sample Input 3

6
1 2 3 4 5 6

Sample Output 3

1

Only i=1 satisfies the condition.

Sample Input 4

8
5 7 4 2 6 8 1 3

Sample Output 4

4

Sample Input 5

1
1

Sample Output 5

1



Sample input:
5
4 2 5 1 3


Sample output:
3

Submission status: Time Limit Exceeded

Solution code:
import sys
import bisect
input = sys.stdin.readline

N = int(input())
P = [int(x) for x in input().split()]

count = 0
for i in range(len(P)):
	if min(P[:i+1]) == P[i]:
		count += 1

print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from collections import deque
n = int(input())
p = list(map(int,input().split()))
p_cutted = []
p_cutted = deque(p_cutted)
ans = 0
for i in range(n):
    p_cutted.append(p[i])
    if min(p_cutted) == p[i]:
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P=list(map(int, input().split()))
a=1
b=0
for i in P:
	M=min(P[:a])
	if M==i:
		b+=1
	a+=1
print(b)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P=list(map(int, input().split()))
a=1
b=0
for i in P:
	Q=P[:a]
	M=min(Q)
	if M==i:
		b+=1
	a+=1
print(b)

Submission status: Time Limit Exceeded

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

cnt = 0
for idx in range(n):
    is_ok = True
    for j in range(idx):
        if p[idx] > p[j]:
            is_ok = False
            break
    if is_ok:
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

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

result = 0

for i, item in enumerate(q):
  if item == min(q[:i+1]):
    result = result + 1

print(result)

Submission status: Time Limit Exceeded

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

result = 0

for i, item in enumerate(q):
  flg = True
  for j in q[:i+1]:
    if j < item:
      flg = False
      break

  if flg:
    result = result + 1

print(result)

Submission status: Time Limit Exceeded

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

result = 0

for i, item in enumerate(q):
  flg = True
  for j in q[:i+1]:
    if j < item:
      flg = False

  if flg:
    result = result + 1

print(result)

Submission status: Time Limit Exceeded

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
p = LIST()
ans = 0
#arr = [0 for _ in range(n)]
arr2 = [0 for _ in range(n)]
for i in range(n):
    for j in range(p[i]):
        arr2[j] += 1
    ans += 1 if arr2[p[i] - 1] == i + 1 else 0
    #print(i+1, arr, sum(arr[p[i] - 1:]), sum(arr[p[i] - 1:]) == i + 1)
print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
inf = sys.maxsize
mod = 10 ** 9 + 7

n = INT()
p = LIST()
ans = 0
arr = [0 for _ in range(n)]
for i in range(n):
    arr[p[i] - 1] = 1
    ans += 1 if sum(arr[p[i] - 1:]) == i + 1 else 0
print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

ans = 0
for i in range(n):
    
    count = 0
    for j in range(i):
        if P[i] <= P[j]:
            count += 1
    if count == i:
        ans += 1
        
print(ans)

Submission status: Time Limit Exceeded

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

box = [n+1 for i in range(n)]
ans = 1
for i in range(1,n):
     if min([p[j] for j in range(i)]) >= p[i]:
          ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

count = 1
for i in range(1,n):
#  print(i, min(p[:i+1]), p[i])
  if min(p[:i+1]) == p[i]:
    count += 1
print(count)

Submission status: Time Limit Exceeded

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

count = n
for i in range(n):
  for j in range(i):
    if p[i] > p[j]:
      count -= 1
      break

print(count)

Submission status: Time Limit Exceeded

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

t=[P[0]]
ans=1
for n in range(1,N):
    if min(t) < P[n]:
        pass
    else:
        ans+=1
    t.append(P[n])
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int, input().split()))
count = 0

for i in range(n):
  flag = True
  for j in range(i):
    if p[i] > p[j]:
      flag = False
  if flag:
    count+=1
print(count)

Submission status: Time Limit Exceeded

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

x=0
y=[]
z=l[0]
for i in range(n):
    y=y+[l[i]]
    z=min(z,l[i])
    if l[i]<=z:
        x+=1
print(x)

Submission status: Time Limit Exceeded

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

x=0
y=[]
for i in range(n):
    y=y+[l[i]]
    if l[i]<=min(y):
        x+=1
print(x)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
count = 1
for i in range(1,p.index(min(p))+1):
    if p[i] == min(p[:i+1]):
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
count = 1
for i in range(1,p.index(min(p))+1):
    if p[i] == min(p[:i+1]):
        count += 1
print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
temp = [0]*n
count = 1
for i in range(1,n):
    temp = p[:i+1]
    if p[i] == min(temp):
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int,input().split()))
cnt = 0
for i in range(N):
    part_min = min(P[:i+1])
    if(part_min == P[i]):
        cnt += 1

print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(map(int,input().split()))
l = []
ans = 0
for i in p:
    l.append(i)
    if min(l) == i:
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

p = [int(s) for s in input().split()]
flag = -1
m_ans = 0
for i in range(n):
    i_min = min(p[:i+1])
    if(i_min < p[i]):
        #print(p[j],p[i])
        m_ans += 1
    


print(n - m_ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

p = [int(s) for s in input().split()]
flag = -1
m_ans = 0
for i in range(n):
    for j in range(i+1):
        if(p[j] < p[i]):
            #print(p[j],p[i])
            m_ans += 1
            break
    


print(n - m_ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int,input().split()))
ans = 1
Pj = []
Pj.append(P[0])
for i in range(1,N):
  Pj.append(P[i])
  if P[i] <= min(Pj):
    ans += 1
  else:
    pass
print(ans)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

n = int(input())
p = np.array(list(int(x) for x in input().split()))
sum = 1

for i in range(1, n):
    if(np.all(p[:i] > p[i])):
        sum += 1

print(sum)

Submission status: Time Limit Exceeded

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

P.reverse()

min_adress = P.index(min(P))
ans = 1

while min_adress != N - 1:
    min_adress = P.index(min(P[min_adress + 1:]), min_adress)
    ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

ans = 0

for i in range(N):
    if i == 0:
        ans += 1
    elif min(P[:i]) >= P[i]:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
p = list(int(x) for x in input().split())
sum = 1

for i in range(1, n):
    if(all(p[i] < j for j in p[:i])):
        sum += 1

print(sum)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
perputation = list(map(int, input().split()))
cnt = 1

if n == 1:
    print("1")
else:
    for i in range(1, n):
        if min(perputation[:i]) >= perputation[i]:
            cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
perputation = list(map(int, input().split()))
cnt = 1

if n == 1:
    print("1")
else:
    for i in range(1, n):
        part = []
        for j in range(i):
            part.append(perputation[j])
        if min(part) >= perputation[i]:
            cnt += 1
    print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import bisect
N = int(input())
P = list(map(int, input().split()))

count = 0
for i in range(N):
    if i == 0:
        count += 1
    elif min(P[:i+1]) == P[i]:
        count += 1
print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
lis = list(map(int, input().split()))
c = 0
if N == 1:
  print(lis[0])
else:
  for i in range(N):
    f = True
    for j in range(i):
      if lis[i] > lis[j]:
        f = False
    if f:
      c += 1
  print(c)

Submission status: Time Limit Exceeded

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

sum = 0
for i in range(n):
  ans = True
  for j in range(i):
    if P[i] > P[j]:
      ans = False
  if ans:
    sum += 1
    
print(sum)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
list_score = list(map(int, input().split()))
list_value = [-1 for _ in range(n)]
ans = 0

for i in range(1, n+1):
    a = list_score.index(i)
    b = list_value[0:a+1]
    #print(a)
    #print(b)
    #print(sum(b), -(a+1))
    if sum(b) == -(a+1):
        ans += 1
    list_value[a] = 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys

def main():
    input = sys.stdin.readline

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

    result = list()

    for i in range(N):
        Pj = list(P[j] for j in range(i+1))
        #print(Pj)
        #Pj = P[0:i+1]
        min_P = min(Pj)
        result.append(min_P)
#        print(min_P)
#        if(P[i] == min_P):
#            count += 1

    print(len(set(result)))

    '''
    count = 0
    flag = True

    for i in range(N):
        for j in range(i):
            if(P[i] > P[j]):
                flag = False
                break
        if(flag):
            count += 1
        flag = True
    print(count)
    '''

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys

def main():
    input = sys.stdin.readline

    N = int(input())
    P = list(map(int,input().split()))
    '''
    count = 0
    result = list()
    r_apeend = result.append

    for i in range(N):
        Pj = P[0:i+1]
        min_P = min(Pj)
        r_append(min_P)
#        print(min_P)
#        if(P[i] == min_P):
#            count += 1

    print(len(set(result)))
    '''

    count = 0
    flag = True

    for i in range(N):
        for j in range(i):
            if(P[i] > P[j]):
                flag = False
                break
        if(flag):
            count += 1
        flag = True
    print(count)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys

def main():
    input = sys.stdin.readline
    
    N = int(input())
    P = list(map(int,input().split()))

    count = 0
    result = list()

    for i in range(N):
        Pj = P[0:i+1]
        min_P = min(Pj)
        result.append(min_P)
#        print(min_P)
#        if(P[i] == min_P):
#            count += 1

    print(len(set(result)))
'''
    for i in range(N):
        for j in range(i):
            if(P[i] > P[j]):
                flag = False
                break
        if(flag):
            count += 1
        flag = True
    print(count)
    '''

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    P = list(map(int,input().split()))

    count = 0
    result = list()

    for i in range(N):
        Pj = P[0:i+1]
        min_P = min(Pj)
        result.append(min_P)
#        print(min_P)
#        if(P[i] == min_P):
#            count += 1

    print(len(set(result)))
'''
    for i in range(N):
        for j in range(i):
            if(P[i] > P[j]):
                flag = False
                break
        if(flag):
            count += 1
        flag = True
    print(count)
    '''

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    P = list(map(int,input().split()))

    count = 0

    for i in range(N):
        Pj = P[0:i+1]
        min_P = min(Pj)
        if(P[i] == min_P):
            count += 1

    print(count)
'''
    for i in range(N):
        for j in range(i):
            if(P[i] > P[j]):
                flag = False
                break
        if(flag):
            count += 1
        flag = True
    print(count)
    '''

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    P = list(map(int,input().split()))

    count = 0
    flag = True

    for i in range(N):
        Pj = P[0:i+1]
        min_P = min(Pj)
        if(P[i] <= min_P):
            count+=1

    print(count)
'''
    for i in range(N):
        for j in range(i):
            if(P[i] > P[j]):
                flag = False
                break
        if(flag):
            count += 1
        flag = True
    print(count)
    '''

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    P = list(map(int,input().split()))

    count = 0
    flag = True

    for i in range(N):
        for j in range(i):
            if(P[i] > P[j]):
                flag = False
                break
        if(flag):
            count += 1
        flag = True
    print(count)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    P = list(map(int,input().split()))

    count = 0
    flag = True

    for i in range(N):
        for j in range(i):
            if(i == j):
                continue
            if(P[i] == max(P)):
                flag = False
                break
            if(P[i] > P[j]):
                flag = False
                break
        if(flag):
            count += 1
        flag = True
    print(count)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    P = list(map(int,input().split()))

    count = 0
    flag = True

    for i in range(N):
        for j in range(i):
            if(P[i] > P[j]):
                flag = False
                break
        if(flag):
            count += 1
        flag = True
    print(count)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    P = list(map(int,input().split()))

    count = 0
    flag = True

    for i in range(N):
        for j in range(i):
            if(P[i] > P[j]):
                flag = False
        if(flag):
            count += 1
        flag = True
    print(count)

if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

total = 0

for i in range(n):
    count = 0
    for j in range(i + 1):
        if l[i] <= l[j]:
            count += 1
    if count == i + 1:
        total += 1

print(total)

Submission status: Time Limit Exceeded

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

for i in range(n-1):
    l_new = sorted(l[0:i+1])
    if l_new[0] >=l[i+1]:
        ans.append(l[i+1])
        
print(len(ans))

Submission status: Time Limit Exceeded

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

count = 0
slist = []

for i in range(0,n):
    slist.append(list[i])
    if min(slist) == list[i]:
        count += 1
    else:
        pass

print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
for i in range(N):
    mi = min(P[:i+1])
    if P[i] <= mi:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int,input().split()))
count = 1

for i in range(1, N):
  isbreak = False
  for j in range(0,i):
    if (P[i] > P[j]):
      isbreak = True
      break
  if isbreak == False:
    count += 1
    
print(count)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

count=0
for i in range(N):
    A=P[i]
    if min(P[0:i+1])==A:
        count += 1
    else:
        continue
print(count)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A=list(map(int,input().split()))
a=1
for i in range(1,N):
    if A[i]<min(A[:i]):
        a+=1
print(a)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=list(map(int,input().split()))
ans=0
m=n
for i in range(1,n+1):
  k=p.index(i)
  if m>k:
    m=k
    ans+=1


print(ans)

Submission status: Time Limit Exceeded

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

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import sys
n = int(sys.stdin.readline())
p =list(map(int, sys.stdin.readline().split()))
cnt = 1
for i in range(1,n):
    if p[i]>p[i-1]:
        continue
    elif min(p[:i+1]) == p[i]:
        cnt+=1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import sys
n = int(sys.stdin.readline())
p =list(map(int, sys.stdin.readline().split()))
cnt = 0
for i in range(n):
    if min(p[:i+1]) == p[i]:
        cnt+=1
print(cnt)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

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

ans = 0
for i in range(n):
    if p_list[i] <= min(p_list[:i+1]):
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

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

ans = 0

flg = True

for i in range(n):
    for j in range(i):
        if p[i] <= p[j]:
            pass
        else:
            flg = False
            break
    if flg:
        ans += 1
    flg = True

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
p = list(map(int, input().split()))
M = []
for i in range(N):
    M.append(min(p[:i+1]))

cnt = 0
for i in range(N):
    if p[i]==M[i]:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
import itertools as it
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n = i()
p = intl()
cnt = 0
for i in range(n):
    if p[i] <= min(p[:i+1]):
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
import itertools as it
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
n = i()
p = intl()
cnt = 0
for i in range(n):
    for j in range(0,i+1):
        if p[j] >= p[i]:pass
        else:break
    if j == i:
        cnt += 1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
num=list(map(int,input().split()))
don=[]
cnt=0
for i in num:
    flg=True
    for j in don:
        if i > j:
            flg=False
    if flg:
        don.append(i)
        cnt+=1
print(cnt)

Submission status: Time Limit Exceeded

Solution code:
import sys
N = int(input())
P = list(map(int, input().split()))

ans = 0

for i in range(N):
    count = 0
    for j in P[0:i]:
        if P[i] <= j:
            count = count + 1
        
    if count == len(P[0:i]):
        ans = ans + 1  

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P=list(map(int,input().split()))
x=0
for i in range(N):
    B=0
    a=P[i]
    for j in range(i+1):
        b=P[j]
        if a>b:
            break
        else:
            B+=1
    if i+1==B:
        x+=1
print(x)

Submission status: Time Limit Exceeded

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

for i in range(len(a)):
  if i == 0:
    ans += 1
  elif min(a[0:(i+1)]) == a[i]:
    ans += 1

print(str(ans))

Submission status: Time Limit Exceeded

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

for i in range(len(a)):
  flag = True
  for j in range(i+1):
    if a[i] > a[j]:
      flag = False
      continue
  if flag:
    ans += 1

print(str(ans))

Submission status: Time Limit Exceeded

Solution code:
import sys
n = int(sys.stdin.readline())
pns = list(map(int, sys.stdin.readline().split(' ')))
c = n	
i = 0
while i < n:
    j = 0
    while j <= i:
        if (pns[i] > pns[j]):
            c -= 1
            break
        j += 1
    i += 1
print(c)

Submission status: Time Limit Exceeded

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

count = 0
for i in range(N):
    tmp = min(Pn[0:i+1])
    if Pn[i] > tmp:
        count += 1

print(N - count)

Submission status: Time Limit Exceeded

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

count = 0
for i in range(N):
    tmp = Pn[0:i+1]
    if Pn[i] > min(tmp):
        count += 1
"""
for i in range(N):
    for j in range(N):
        if Pn[i] > Pn[j]:
            count += 1
            break
        if j >= i:
            break
"""

print(N - count)

Submission status: Time Limit Exceeded

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

count = 0
for i in range(N):
    for j in range(N):
        if Pn[i] > Pn[j]:
            count += 1
            break
        if j >= i:
            break

print(N - count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
P = list(map(int, input().split()))
ans = 0

for i in range(1, N+1):
    cnt = 0
    for j in range(N):
        if j <= i-1 and P[i-1] <= P[j]:
            cnt += 1
            if cnt == i:
                ans += 1
        else:
            break

print(ans)

Submission status: Time Limit Exceeded

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

ans = 0
for i in range(N):
    # print(P[:i+1])
    m = min(P[:i+1])
    if P[i] <= m:
        # print(i)
        ans += 1
    # m = max(P[:i+1])
    # print(m)


print(ans)

Submission status: Time Limit Exceeded

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

ans = 0
for i in range(N):
    Pi = P[i]
    flag = True
    for j in range(i+1):
        Pj = P[j]
        if not(Pi <= Pj):
            flag = False
    if flag:
        ans += 1
print(ans)

Submission status: Time Limit Exceeded

Solution code:
from itertools import accumulate

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

ans = 0

"""
for i, p in enumerate(P):
    # if np.any(P[0:i] < p): あまり以下と変わらなかった
    # if any([True for p2 in P[0:i] if p2 < p]): # 2回のループが☓ O(n^2)なので
        pass
    else:
        ans += 1
"""

for i, p in enumerate(P):
    tmp = list(accumulate(P[0:i+1], min))[-1]
    if p <= tmp:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
import numpy as np

N = int(input())
P = np.array(list(map(int, input().split())))

ans = 0

# 2回のループが☓ O(n^2)なので
for i, p in enumerate(P):
    if np.any(P[0:i] < p):
    # if any([True for p2 in P[0:i] if p2 < p]):
        pass
    else:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:


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

ans = 0

for i, p in enumerate(P):
    if any([True for p2 in P[0:i] if p2 < p]):
        pass
    else:
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
p=list(map(int,input().split()))
lis=[]
count=0
tmp=10**10
for i in p:
    lis.append(i)
    t=min(lis)
    if i <= t:
        count +=1
print(count)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
num=list(map(int,input().split()))
don=[]
#don.append(num[0])
for i in num:
	flg=True
	for j in don:
		if i > j:
			flg=False
	if flg:
		don.append(i)
print(len(don))

Submission status: Time Limit Exceeded

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

Nmax = N
for i in range(N):
    if min(P[:i + 1]) < P[i]:
        Nmax += -1

print(Nmax)

Submission status: Time Limit Exceeded

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

ans = 0

for i in range(n):
    #i番目までのリストを作成
    check_part = p_list[:i+1]
    #その中で一番小さいかどうか
    if p_list[i] == min(check_part):
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

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

count = 1
num = 0
for i in range(1,N):
    num = min(P[0:i+1])
    if(P[i] == num):
        count += 1

print("%d"%(count))

Submission status: Time Limit Exceeded

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

cout = 0



for i in range(0,n):
    if i == 0:
        cout = cout + 1
    else:
        if min(p[0:i+1]) == p[i]:
            cout = cout + 1



print(cout)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
List = list(map(int, input().split()))
num = 0

for i in range(N):
  Sorted = sorted(List[:i+1])
  if Sorted[0] == List[i]:
    num += 1
print(num)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
List = list(map(int, input().split()))
num = 0

for i in range(N):
  if min(List[:i+1]) == List[i]:
    num += 1

print(num)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
List = list(map(int, input().split()))
num = 0

for i in range(N):
  for j in range(i):
    if List[i] > List[j]:
      break
  else:
    num += 1
print(num)

Submission status: Time Limit Exceeded

Solution code:
from functools import reduce

n = int(input())
v = list(map(int, input().split(' ')))

partial_sum = lambda a, b: a + [min(a[-1], b)]
mini = reduce(partial_sum, v[1:], v[0:1])

ans = 0
for i in range(len(v)):
    if (v[i] == mini[i]):
        ans += 1

print(ans)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
P=list(map(int,input().split()))
def m(n):
    return min(P[:n+1])
A=[]
for i in range(N):
    A.append(m(i))
print(len(set(A)))

Submission status: Time Limit Exceeded

Solution code:
N=input()
P=list(map(int,input().split()))
t=0
while len(P)>0:
    A=P[0]
    P=[i for i in P if i<A]
    t=t+1
print(t)

Submission status: Time Limit Exceeded

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

print(count)