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: Accepted

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

Submission status: Accepted

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

    count = 0
    leftmin = P[0]
    for i,p in enumerate(P):
        if leftmin>=p:
            count += 1
        leftmin = min(leftmin,p)
    print(count)

main()

Submission status: Accepted

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

mins=[0]*n
mins[0]=p[0]
for i in range(1,n):
    mins[i] = min(mins[i-1], p[i])
ans=0
for i in range(0, n):
    if p[i] <= mins[i]:
        ans+=1

print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
cnt = 0
res = float('Inf')
for n in range(N):
    if P[n] < res:
        res = P[n]
        cnt += 1
print(cnt)

Submission status: Accepted

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

print(cnt)

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


def main():
    _ = readline()
    Ps = list(map(int, readline().split()))
    ans = 1
    tmp = Ps[0]
    for P in Ps[1:]:
        if tmp > P:
            ans += 1
            tmp = P
        if P == 1:
            break
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

for num in P:
    if num <= lowest:
        ans += 1
    lowest = min(lowest, num)

print(ans)

Submission status: Accepted

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

count = 0
tmp = n
for i in range(n):
    if p[i] <= tmp:
        count += 1
        tmp = p[i]
print(count)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
Q = []
num = 2*10**5
for i in range(N):
    if num > P[i]:
        num = P[i]
    Q.append(num)
ans = 0
for i in range(N):
    if P[i]<=Q[i]:
        ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = [int(i) for i in input().split()]

ans = 0
min_num = float("inf")
for i in range(N):
    if P[i] <= min_num:
        ans += 1
        min_num = P[i]

print(ans)

Submission status: Accepted

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

pre = p[0]
ans = 0
for i in p:
    if i <= pre:
        ans += 1
        pre = i    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
P = list(map(int, input().split()))
minv = float('inf')
count = 0
for p in P:
	if p <= minv:
		minv = p
		count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
m = float("inf")
count = 0

for i in P:
    if m > i:
        m = i
    if m == i:
        count += 1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
m = float("inf")
count = 0
for i in P:
    if m > i:
        m = i
    if m == i:
        count += 1
print(count)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import collections
import itertools as it
import math
#import numpy as np
 
#  = input()
n  = int(input())
#  = map(int, input().split())
p  = list(map(int, input().split()))
#  = [int(input()) for i in range(N)]
#
# c = collections.Counter()

ans = 0
min_ = 10**9
for i in range(n):
    if p[i] < min_:
        ans += 1
        min_ = p[i]

print(ans)

Submission status: Accepted

Solution code:
input()
p0, *P = map(int, input().split())
cnt = 1
curr = p0
for p in P:
    if p < curr:
        cnt += 1
        curr = p
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

N = int(input())
P = list(map(int, input().split()))
M = [0] * N
M[0] = P[0]
m = P[0]
for i in range(1, N):
    m = min(P[i], m)
    M[i] = m


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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

def makelist(n, m):
    return [[0 for _ in range(m)] for _ in range(n)]

N = int(input())
P = list(map(int, input().split()))
m = int(1e9)
ans = 0
for e in P:
    if e < m:
        ans += 1
        m = e
print(ans)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    
    d = set()
    mini = a[0]
    for i in range(n):
        if mini >= a[i]:
            mini = a[i]
        d.add(mini)
    print(len(d))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
A=list(map(int,input().split()))
cnt=0
tmp=n+1
for i in range(n):
    if A[i]<=tmp:
        tmp=A[i]
        cnt+=1
    else:
        pass
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
nums = list(map(int,input().split()))
k = n + 1
ans = 0

for i in range(n):
    if k >= nums[i]:
        ans += 1
    k = min(k, nums[i])

print(ans)

Submission status: Accepted

Solution code:

N = int(input())
P = list(map(int, input().split()))
mx = P[0]
counter = 0
for p in P:
    mx = min(mx, p)
    if mx == p:
        counter += 1
print(counter)

Submission status: Accepted

Solution code:
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
p = li()

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int, input().split()))
minn = 10**10
res = 0
for i in range(n):
    el = arr[i]
    if el <= minn:
        res += 1
        minn = el
print(res)

Submission status: Accepted

Solution code:
N = int(input())

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

Min = 2*(10**6)
cnt =0

for i in range (N):
    if Min >=P[i]:
        Min = P[i]
        cnt+=1
        
        
print(cnt)

Submission status: Accepted

Solution code:



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


prevMin = float('inf')

ans = 0
for i in lst:
    if prevMin > i:
        ans += 1
        prevMin = i

print(ans)

Submission status: Accepted

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

mn = p[0]
cnt = 0
for i in range(n):
    if p[i] <= mn:
        cnt += 1
    mn = min(mn, p[i])

print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
m=int(2*10e5)
ans=0
for i in p:
    if(i<=m):
        m=i
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
n1 = int(input())

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

r1 = 0
m1 = n1 + 1

for i1 in range(n1):
    if n2[i1] < m1:
        r1 +=1
        m1 = n2[i1]

print(r1)

Submission status: Accepted

Solution code:
N = int(input())
P = [int(i) for i in input().split()]

mn = 10**6
ans = 0

for i in P:
    if i <= mn:
        ans += 1
        mn = i
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int,input().split()))
MIN = P[0]
count = 0
for p in P:
    if MIN >= p:
        count += 1
        MIN = p
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from collections import Counter
from collections import deque
import math
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))


n=int(input())
p=lmp()
m=p[0]
ans=1
for i in range(1,n):
    if m>=p[i]:
        m=p[i]
        ans+=1
print(ans)

Submission status: Accepted

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

ans = 1
tmp = P[0]
for i in range(1,N):
  if P[i] <= tmp:
    ans+=1
    tmp = P[i]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
Pmin = 2*10**5+1
ans=0
for i in range(N):
  if P[i]<=Pmin:
    ans+=1
    Pmin=P[i]

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().strip())
p_lst = [int(x) for x in stdin.readline().strip().split()]
min_val = p_lst[0]
cnt = 0

for p in p_lst:
  if p <= min_val:
    cnt += 1
    min_val = p
    
print(cnt)

Submission status: Accepted

Solution code:
import sys
N=int(input())
P=list(map(int,input().split()))
ans=1
tmp=P[0]
for i in range(1,N):
    if P[i]<=tmp:
        ans+=1
        tmp=P[i]
    else:
        continue
print(ans)

Submission status: Accepted

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

m=P[0]
ans=1

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

print(ans)

Submission status: Accepted

Solution code:
# import sys
# import math
# import itertools
# from collections import deque
# from collections import defaultdict
# import heapq
# import copy
# import bisect
# import numpy as np
# from scipy.special import comb

# def my_input(): return sys.stdin.readline().rstrip()
# sys.setrecursionlimit(100000)
INF = 1001001001001
# MOD = 1000000007


def main():

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

    ans = 0
    min_num = INF
    for p in P:
        min_num = min(min_num, p)
        if min_num >= p:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

List = list(map(int,input().split()))

m = 10 ** 10
cnt = 0

for i in range(N):
  a = List[i]
  if a <= m :
    cnt += 1
    m = a
    
print(int(cnt))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
ll = list(map(int, input().split()))
min = ll[0]
ans = 1
for l in ll[1:]:
    if l < min:
        ans += 1
        min = l
    else:
        pass
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
cnt=0
min_value=3*10**5
for p in P:
	if p<=min_value:
		cnt+=1
		min_value=p
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# For taking integer inputs.
def inp():
    return(int(input()))


# For taking List inputs.
def inlist():
    return(list(map(int, input().split())))


# For taking string inputs. Actually it returns a List of Characters, instead of a string, which is easier to use in Python, because in Python, Strings are Immutable.
def instr():
    s = input()
    return(list(s[:len(s)]))


# For taking space seperated integer variable inputs.
def invr():
    return(map(int, input().split()))


N = inp()
P = inlist()
c = 0
m = 200000000

for i in range(N):
    if P[i] < m:
        m = P[i]
    if m >= P[i]:
        c += 1


print(c)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int, input().split()))
m = 200001
r = 0
for j in p:
    if min(j, m) == j:
        r += 1
    m = min(j, m)
print(r)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
ans = 0
minimum = 200001
for p in P:
  if p <= minimum:
    minimum = p
    ans += 1
print(ans)

Submission status: Accepted

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

min_p = N
count = 0
for p in P:
    min_p = min(min_p, p)
    if p <= min_p:
        count += 1

print(count)

Submission status: Accepted

Solution code:
#重い操作二重は耐えない．minが更新されたか否か
n = int(input())
p = list(map(int,input().split()))
ans = 0
m= 10**10

for i in range(n):
  tmp = m
  m = min(m,p[i])
  if tmp != m:
    ans += 1
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int,input().split()))
ans = 0
m= 10**10

for i in range(n):
  tmp = m
  m = min(m,p[i])
  if tmp != m:
    ans += 1
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

MinP = [[]]*n
prev = n+1
count = 0
for i, p in enumerate(P):
    MinP[i] = min(prev, p)
    if MinP[i] == p:
        count += 1
    prev = MinP[i]
print(count)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int,input().split()))
pre = True
premin = p[0]
ans = 1
for i in range(1,n):
  if pre and p[i]<=p[i-1]:
    ans += 1
    premin = p[i]
  elif not pre and p[i]>p[i-1]:
    pre = False
  else:
    if premin>=p[i]:
      ans += 1
      pre = True
      premin = p[i]
    else:
      pre = False
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import collections
n = int(raw_input())
elems = map(int, raw_input().split(' '))



m,c = +float('inf'),0 
for e in elems:
	if e <= m: c +=1
	m = min(e, m) #elems[j])
print c

Submission status: Accepted

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

count = 1
temp = P_list[0]

for j in range(1, N):
    if P_list[j] == min(P_list[j], temp):
        count += 1
        temp = P_list[j]

print(count)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
P=list(map(int,input().split()))
ans=0
MIN=10**6
for i in range(N):
  MIN=min(MIN,P[i])
  if MIN>=P[i]:
    ans+=1
print(ans)

Submission status: Accepted

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

N = P.index(1)
a = 1
j = P[0]
for i in range(N):
    if j >= P[i+1]:
        j = P[i+1]
        a +=1


print(a)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

def LI(): return list(map(int, stdin.readline().split()))
def LS(): return list(stdin.readline())

n = int(input())
p = LI()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p = [int(x) for x in input().split()]

ans = 1
base = p[0]

for i in range(1, n):
    if p[i] < base:
        ans += 1
        base = p[i]

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
L = [int(x) for x in input().split()]
count = 1
Min = L[0]
for i in range(1,N):
  if L[i]<=Min:
    count+=1
  Min = min(Min,L[i])
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(p)):
    if p[i]<=min:
        min = p[i]
        ans += 1

print(ans)

Submission status: Accepted

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

mi = P[0]
cnt = 1
for i in range(1,N):
    if P[i] <= mi:
        mi = P[i]
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
low = 10**6
ans = 0
for i in range(n):
	pi = p[i]
	if pi<=low:
		low = pi
		ans += 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=[0]*n
a[:]=map(int,input().split())
r=0
s=a[0]
#import numpy as np
for jj in range(n):  
  if a[jj]<=s:
    s=a[jj]
    r+=1
print(r)

Submission status: Accepted

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

cnt = 0
p_comp = p[0]
for i, p_ in enumerate(p):
    p_comp = min(p_comp, p[i])
    if p_ <= p_comp:
        cnt += 1

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

print(cnt)

Submission status: Accepted

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


def main():
    N = int(input())
    P = list(map(int, input().split()))
    minimum = float('inf')
    answer = 0
    for i in P:
        if minimum >= i:
            answer += 1
            minimum = i
    print(answer)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
N = int(input())
P = list(map(int, input().split()))
minn = 1
c = 0
for i in range(N):
    if minn > P[i] or i == 0:
        minn = P[i]
        c += 1
print(c)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

ans = 0
m = 10**10

for p in p_list:
    if p <= m:
        ans += 1
        m = p
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
P = list(map(int, input().split()))
m = N
ans = 0
for p in P:
  m = min(m, p)
  if m >= p:
    ans += 1
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

cnt = 1
mini = P[0]
for i in range(1, N):
    if P[i] <= mini:
        mini = P[i]
        cnt += 1
print(cnt)

Submission status: Accepted

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

for i in range(N):
    if P[i] <= mini:
        mini = P[i]
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


# 入力を整数に変換して受け取る
def input_int():
    return int(input())


# マイナス1した値を返却
def int1(x):
    return int(x) - 1


# 半角スペース区切り入力をIntに変換してMapで受け取る
def input_to_int_map():
    return map(int, input().split())


# 半角スペース区切り入力をIntに変換して受け取る
def input_to_int_tuple():
    return tuple(map(int, input().split()))


# 半角スペース区切り入力をIntに変換してマイナス1した値を受け取る
def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n = input_int()
    p = input_to_int_tuple()

    cnt = 0
    pre_min = 10 ** 6
    for i in range(n):

        if i == 0 or p[i] <= pre_min:
            cnt += 1

        pre_min = min(pre_min, p[i])

        # temp = True
        # for j in range(i):
        #     if p[i] > p[j]:
        #         temp = False
        #         break
        # if temp:
        #     cnt += 1

    print(cnt)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p = [int(x) for x in input().split()]
minx = float('INF')
cnt = 0
for i in range(n):
    if(minx>p[i]):
        minx = p[i]
        cnt += 1
print(cnt)

Submission status: Accepted

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

cnt = 0
minn = p_list[0]
for i in range(n):
    minn = min(p_list[i], minn)
    if p_list[i] == minn:
        cnt += 1
print(cnt)

Submission status: Accepted

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

ct = 1
m = P[0]
for i in range(1, n):
    if P[i] <= m:
        ct += 1
    m = min(m, P[i])
print(ct)

Submission status: Accepted

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

total=1
minP=P[0]
for i in range(1,N):
    if P[i]<minP:
        total+=1
        minP=P[i]
print(total)

Submission status: Accepted

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

cnt=1
m=p[0]
for i in range(1,n):
    if m<=p[i]:
        pass
    else:
        cnt+=1
        m=p[i]
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
INF = 10**18
m = INF
for p in P:
    if p <= m:
        ans += 1
    m = min(m, p)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest


def resolve():
    N = int(input())
    P = [int(i) for i in input().split()]
    minp = P[0]
    sumP = 0
    for p in P:
        minp = min(minp, p)
        if p == minp:
            sumP += 1
    print(sumP)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """5
4 2 5 1 3"""
        output = """3"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """4
4 3 2 1"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """6
1 2 3 4 5 6"""
        output = """1"""
        self.assertIO(input, output)

    def test_入力例_4(self):
        input = """8
5 7 4 2 6 8 1 3"""
        output = """4"""
        self.assertIO(input, output)

    def test_入力例_5(self):
        input = """1
1"""
        output = """1"""
        self.assertIO(input, output)


if __name__ == "__main__":
    # unittest.main()
    resolve()

Submission status: Accepted

Solution code:
import math
import copy

neko = 0
low = 10**6
n = int(input())
p = [int(x) for x in input().split()]
for i in range(n):
    if p[i]<low:
        neko += 1
    if p[i]<low:
        low = p[i]
print(neko)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ps = list(map(int, input().split()))
ans = 0
minimum = float('inf')
for p in ps:
  if p <= minimum:
    ans += 1
  minimum = min(minimum, p)

print(ans)

Submission status: Accepted

Solution code:
import math
n=int(input())
i = list(map(int, input().split()))
s=[]
cnt=0
x=math.inf
for j in range(n):
    if min(x,i[j])==i[j]:
        x=i[j]
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
#C
n = int(input())
p = list(map(int, input().split()))
n = p[0]
ans = 1
for i, z in enumerate(p):
    if i == 0:
        continue
    if z <= n:
        ans += 1
    n = min(n, z)
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    n = int(input())
    p = list(map(int, input().split()))
    min = p[0]
    ans = 1
    for i in range(1, n):
        if p[i] <= min:
            min = p[i]
            ans += 1
    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

Solution code:

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

minimum = 10**9
count = 0
for i in range(n):
    minimum = min(minimum,p[i])
    if minimum >= p[i]:
        count += 1

print(count)

Submission status: Accepted

Solution code:
# ABC152C

# p[0] ~ p[i] の最小値と p[i] を比べればよい
# 最小値は逐次更新する

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

Submission status: Accepted

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

min=1000000000000000
cnt=0
for i in range(n):
    if p[i]<=min:
        min=p[i]
        cnt+=1
print(cnt)

Submission status: Accepted

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

_min = p[0]
ans = 0
for i in p:
    if _min >= i:
        _min = i
        ans += 1

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

cnt=0
min_val=p[0]

for i in range(n):
    if min_val>=p[i]:
        min_val=p[i]
        cnt+=1
    else:
        continue

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
p=list(map(int,input().split()))
ans=0
m=n+1

for i in range(n):
  if m>p[i]:
    ans+=1
    m=p[i]

print(ans)

Submission status: Accepted

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

print(count)

Submission status: Accepted

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

print(c)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

tmp = P[0]
M = [tmp]
for i in range(1, n):
    if P[i] <= tmp:
        tmp = P[i]
        M.append(tmp)

print(len(M))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
p = list(map(int, input().split()))
ans=1
m=p[0]
for i in range(1,len(p)):
  if p[i]==1:
    ans=ans+1
    break
  elif p[i]>m:
    continue
  else:
    ans=ans+1
    m=p[i]
print(ans)