CodeEff/ECCO huggingface dataset:
# Original solution
n = int(eval(input()))
p = list(map(int,input().split()))
ans = 0

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

# Optimized solution
n = int(eval(input()))
p = list(map(int,input().split()))
ans = 0
Min= float('inf')
for i in range(n-1):
    if Min > p[i]:
        Min = p[i]
    if Min > p[i+1]:
        ans += 1
print((ans+1))
# Original solution
n=int(eval(input()))
p=[]*n
p=list(map(int,input().split()))
cnt=0
for i in range(n):

    for j in range(0,i+1):
        if p[j]<p[i]:
            break
        if i==j:
            cnt+=1
print(cnt)

# Optimized solution
n=int(eval(input()))
p=[]*n
p=list(map(int,input().split()))
cnt=0
com=p[0]
for i in range(n):
    if com>=p[i]:
        cnt+=1
    com=min(com,p[i])
print(cnt)
# Original solution
n = int(eval(input()))
p = list(map(int, input().split(' ')))
res = 0
for i in range(n):
    x = p[:i+1]
    if min(x) >= p[i]:
        res += 1
print(res)

# Optimized solution
n = int(eval(input()))
p = list(map(int, input().split(' ')))
res = 0
y = p[0]
for i in range(n):
    z = p[i]
    if y >= z:
        y = z
        res += 1
print(res)
# Original solution
import copy
n = int(eval(input()))
num = list(map(int,input().split()))

end = n
i = 0
while i < end-1:
    for j in range(end-1, i, -1):
        if num[j] > num [i]:
            num.pop(j)
    end = len(num)
    i += 1
    
print(end)

# Optimized solution
n = int(eval(input()))
num = list(map(int,input().split()))

now = num[0]
cnt = 1
for i in range(1,n):
    if (now > num[i]):
        cnt+=1
        now = num[i]
    
print(cnt)
# Original solution
n = int(eval(input()))
nums = list(map(int, input().split()))
if nums[0] == 1:
    print("1")
else:
    cnt = 1
    for i in range(1, n):
        if nums[i] < min(nums[:i]):
            cnt += 1
            if nums[i] == 2:
                cnt += 1
                break
            if nums[i] == 1:
                break
    print(cnt)

# Optimized solution
n = int(eval(input()))
nums = list(map(int, input().split()))
cnt = 1
min = nums[0]
for i in range(1, n):
    if nums[i] < min:
        min = nums[i]
        cnt += 1
print(cnt)
# Original solution
n = int(eval(input()))
p = [int(i) for i in input().split()]

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

print(cnt)

# Optimized solution
n = int(eval(input()))
p = [int(i) for i in input().split()]

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

print(cnt)
# Original solution
N = int(eval(input()))
P = list(map(int, input().split()))

A = 0

for i in range(N):
  if P[i] <= min(P[0:i+1]):
  	A += 1
  if P[i] == 1:
    break
  elif P[i] == 2:
    A+=1
    break
print(A)

# Optimized solution
N = int(eval(input()))
P = list(map(int, input().split()))
 
A = 0
C = P[0]
for i in range(N):
  if P[i] <= C:
    C = P[i]
    A += 1
print(A)
# Original solution
n = int(eval(input()))
p = [int(i) for i in input().split()]
res = 0

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

# Optimized solution
n = int(eval(input()))
p = [int(i) for i in input().split()]
res = 1
min = p[0]
for i in range(1,n):
    if p[i] < min:
        res += 1
        min = p[i]
 
print(res)
# Original solution
n = int(eval(input()))
P = [int(el) for el in input().split(" ")]

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

# Optimized solution
n = int(eval(input()))
P = [int(el) for el in input().split(" ")]

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

print(ans)
# Original solution
n = int(eval(input()))
p = list(map(int, input().split()))

t = p[0]
ans = 0

for i in p:
  if i <= t:
    ans += 1
    t = i
print(ans)

# Optimized solution
n = int(eval(input()))
p = list(map(int, input().split()))

x = sum(p)
y = 0
for i in p:
  if x >= i:
    x = i
    y += 1
print(y)
# Original solution
N=int(eval(input()))
p=list(map(int,input().split()))
a=[]
for i in range(N):
  for k in range(i):
    if p[i]>=p[k]:
     a.append(p[i])
c=set(a)
print((N-len(c)))

# Optimized solution
N=int(eval(input()))
p=list(map(int,input().split()))
a=[]
k=p[0]
for i in range(1,N):
    if k>p[i]:
     a.append(p[i])
     k=p[i] 
print((len(a)+1))
# Original solution
N = int(eval(input()))

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

P = [0] + P
     
count = 0
min = 10000000000000
for i in range(1, N+1):
    if min > P[i]:
        min = P[i]
    elif min < P[i]:
        continue

    for j in range(1, i+1):
        #print(i, P[i], j , P[j])
        if P[i] > P[j]:
            #print("out", i)
            break
    else:
        #print("ok", i)
        count += 1
        
    if P[i] == 1:
        break

print(count)

# Optimized solution
N = int(eval(input()))

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

P = [0] + P
     
count = 0
min = 10000000000000
for i in range(1, N+1):
    if min > P[i]:
        min = P[i]
    elif min < P[i]:
        continue
    """
    for j in range(1, i+1):
        #print(i, P[i], j , P[j])
        if P[i] > P[j]:
            #print("out", i)
            break
    else:
        #print("ok", i)
        count += 1
    """
    count += 1
        
    if P[i] == 1:
        break

print(count)
# Original solution
N = int(eval(input()))
P = list(map(int, input().split()))

judge = [1]*N
for i in range(N):
  for j in range(i):
    if P[i] > P[j]:
      judge[i] = 0
      break
print((judge.count(1)))

# Optimized solution
N = int(eval(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)
# Original solution
N = int(eval(input()))
P = list(map(int,input().split()))
count = 0

for i,p in enumerate(P) :
    pj_min = min(P[:i+1])
    if p <= pj_min :
        count += 1
    
print(count)

# Optimized solution
N = int(eval(input()))
P = list(map(int,input().split()))
count = 0
minlist = []

for i,p in enumerate(P) :
    if i == 0 :
        minlist.append(p)
        continue

    if p < minlist[i-1] :
        minlist.append(p)
    else:
        minlist.append(minlist[i-1])
    
for i,p in enumerate(P) :
    pj_min = minlist[i]
    if p <= pj_min :
        count += 1
    
print(count)
# Original solution
n = int(eval(input()))
p = list(map(int,input().split()))

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

# Optimized solution
n = int(eval(input()))
p = list(map(int,input().split()))

ans = 0
n_min = 0
for i in range(0,n):
    if i == 0:
        ans += 1
        n_min = p[i]
        continue
    if p[i] <= n_min:
        ans += 1
        n_min = p[i]
print(ans)
# Original solution
n = int(eval(input()))
p = list(map(int,input().split()))
ans = 0
list_a=[]
for i in range(len(p)):
  for j in range(i+1):
    list_a.append(p[j])
  m = min(list_a)
  if m == p[i]:
    ans += 1
print(ans)

# Optimized solution
n = int(eval(input()))
p = list(map(int,input().split()))
ans = 0
list_a=[]
min = p[0]
for i in p:
  if min >= i:
    min = i
    ans += 1
print(ans)
# Original solution
n = int(eval(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)

# Optimized solution
n = int(eval(input()))
p = list(map(int,input().split()))
count = 0
min = n+1
for i in range(n):
  if min > p[i]:
    count += 1
    min = p[i]
print(count)
# Original solution
n=int(eval(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)  

# Optimized solution
n=int(eval(input()))
p=list(map(int,input().split()))
ans=0
a=p[0]
for i in range(n):
    if p[i] <= a:
        ans+=1
    
    a=min(a,p[i])    


print(ans)
# Original solution
n = int(eval(input()))

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

s = [0]*n

for i in range(1,n+1):
    a = min(p[:i])
    
    s[i-1] = a

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

# Optimized solution
n = int(eval(input()))

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

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

print(cnt)
# Original solution
N = int(eval(input()))
P = list(map(int, input().split()))

ok_count = 0
for i in range(N):
    ok_flag = True
    for j in range(i):
        if P[i] > P[j]:
            ok_flag = False
            break
    
    if ok_flag:
        ok_count += 1

print(ok_count)


# Optimized solution
N = int(eval(input()))
P = list(map(int, input().split()))

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

print((N - NG_count))
# Original solution
N = int(eval(input()))
P = list(map(int, input().split(' ')))
count = 0
for i, value in enumerate(P):
    if min(P[:i+1]) == value:
        count += 1
print(count)

# Optimized solution
N = int(eval(input()))
P = list(map(int, input().split(' ')))
count = 1
min_value = P[0]
for i in range(1, N):
    if P[i] <= min_value:
        min_value = P[i]
        count += 1
print(count)
# Original solution
n = int(eval(input()))
p = list(map(int, input().split()))

ans = 1 #i=1は絶対満たす
for i in range(1,n):
    if p[i] == min(p[:(i+1)]):
        ans += 1
    
print(ans)

# Optimized solution
n = int(eval(input()))
p = list(map(int, input().split()))
ans = 1 #i=1は絶対満たす
now_min = p[0]
for i in range(1,n):
    if p[i] <= now_min:
        ans+=1
        now_min = p[i]
print(ans)
# Original solution
n = int(eval(input()))
s = list(map(int , input().split()))
count = 0
for i in range(n):
  if s[i] == min(s[:i + 1]):
    count += 1

print(count)

# Optimized solution
n = int(eval(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)
# Original solution
n = int(eval(input()))
p = [int(i) for i in input().split()]
count = 0
for i in range(n):
    if p[i] <= (min(p[0:i]) if i != 0 else p[0]):
        count += 1
print(count)

# Optimized solution
n = int(eval(input()))
p = [int(i) for i in input().split()]
min = n+1
count = 0
for i in range(n):
    if min >= p[i]+1:
        count += 1
        min = p[i]+1
print(count)
# Original solution
N = int(eval(input()))
P = list(map(int, input().split()))
c = 0
for i in range(N):
    if all([P[i] <= p for p in P[:i+1]]):
        c += 1
    #if P[i] >= P[i + 1]:
     #   c += 1
print(c)


# Optimized solution
N = int(eval(input()))
P = list(map(int, input().split()))
c = 0
m = N+1
for i in range(N):
    if P[i] <= m:
        c += 1
    m = min(P[i], m)
print(c)
# Original solution
N = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
for i in range(0,N):
    if min(P[:i+1]) == P[i]:
        ans += 1
    else:
        continue
print(ans)

# Optimized solution
N = int(eval(input()))
P = list(map(int, input().split()))
ans = 0
current_min = N
for i in range(0,N):
    current_min = min(current_min, P[i])
    if current_min == P[i]:
        ans += 1
print(ans)
# Original solution
n = int(eval(input()))
p = list(map(int, input().split()))

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

print(ans)

# Optimized solution
n = int(eval(input()))
p = list(map(int, input().split()))

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

print(ans)
# Original solution
a=int(eval(input()))
b=list(map(int,input().split()))
c=[]
d=0
for i in range(a):
  c.append(b[i])
  if min(c)>=b[i]:
    d+=1
  else:
    pass
print(d)

# Optimized solution
N=int(eval(input()))
P=list(map(int,input().split()))
b=N
a=0
for i in range(N):
  if P[i]<=b:
    b=P[i]
    a+=1
print(a)
# Original solution
N = int(eval(input()))
P = [ int(i) for i in input().split()]

num = 0
for base in range(N):
    flag = 0
    for n in range(base):
        if P[n] < P[base]:
            flag = 1
    if flag == 1:
        num = num+1
        
print((N-num))

# Optimized solution
N = int(eval(input()))
P = [ int(i) for i in input().split()]
 
num = 0
min = N
for base in range(N):
    if P[base] <= min:
        min = P[base]
        num += 1
        
print(num)
# Original solution
a = int(eval(input()))
b = list(map(int, input().split()))
b_list = list(b)
count = 0
for i in range(len(b_list)):
    if b_list[i] == min(b_list[:i+1]):
        count += 1
        
print(count)

# Optimized solution
a = int(eval(input()))
b_list = list(map(int, input().split()))
count = 0
mini=a
for i in range(len(b_list)):
    if b_list[i] <= mini:
        count += 1
        mini = b_list[i]
        
print(count)
# Original solution
n=int(eval(input()))
c=list(map(int,input().split()))
count1=1
for i in range(1,n):
  t=max(c[:i])
  g=min(c[:i])
  if c[i]<=t and c[i]<=g:
    count1+=1
print(count1)

# Optimized solution
n=int(eval(input()))
c=list(map(int,input().split()))
minimum=100000000
count=0
for i in range(len(c)):
    if c[i]<minimum:
        minimum=c[i]
    if c[i]<=minimum:
        count+=1
print(count)
# Original solution
n = int(eval(input()))
p_n = list(map(int, input().split()))
ans = 1
p_i_1 = [p_n[0]]
m = p_n[0]
for i in range(1, n):
    if m > p_n[i]:
        ans += 1
    m = min(m, p_n[i])
    p_i_1.append(p_n[i])
    if m == 1:
        break
print(ans)

# Optimized solution
N=int(eval(input()))
P=list(map(int,input().split()))
min=10**8
count=0
for i in range(N):
  if P[i]==1:
    print((count+1))
    exit()
  elif min>=P[i]:
    count+=1
    min=P[i]
# Original solution
N=int(eval(input()))
P=list(map(int,input().split()))
min=10**8
count=0
for i in range(N):
  if P[i]==1:
    print((count+1))
    exit()
  elif min>=P[i]:
    count+=1
    min=P[i]

# Optimized solution
N=int(eval(input()))
P=list(map(int,input().split()))
num=100000000
ans=0
for i in P:
  if num>i:
    ans+=1
    num=i
print(ans)
# Original solution
n = int(eval(input()))
l = list(map(int, input().split()))

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


# Optimized solution
n = int(eval(input()))
l = list(map(int, input().split()))

ans = 0
min_val = l[0]
for i in range(n):
    if min_val >= l[i]:
        ans += 1
        min_val = l[i]
print(ans)
# Original solution
N = int(eval(input()))
P = list(map(int, input().split()))

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

# Optimized solution
N = int(eval(input()))
P = list(map(int, input().split()))

Q = []
for i in range(N):
    if i == 0:
        Q.append(P[i])
    else:
        Q.append(min(Q[-1], P[i]))

cnt = 0
for i in range(N):
    if P[i] <= Q[i]:
        cnt += 1
print(cnt)
# Original solution
N=int(eval(input()))
P=[int(i) for i in input().split()]
cnt=0
for r in range(N):
    if P[r]==min(P[0:r+1]):
        cnt+=1
    else:
        continue
print(cnt)

# Optimized solution
N=int(eval(input()))
P=[int(i) for i in input().split()]
min=2*(10**5)+1
cnt=0
for r in P:
    if min>=r:
        min=r
        cnt+=1
    else:
        continue
print(cnt)
# Original solution
n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
for i in range(n):
  sorted_p = sorted(p[:i+1])
  if sorted_p[0] == p[i]:
    cnt += 1
print(cnt)

# Optimized solution
n = int(eval(input()))
p = list(map(int, input().split()))
cnt = 0
p_min = n+1
for i in range(n):
  if p_min > p[i]:
    cnt += 1
    p_min = p[i]
print(cnt)
# Original solution
def solve(n, p_list):

    count = 1
    for i in range(n-1):
        target_num = p_list.pop()
        if min(p_list) > target_num:
            count += 1
    return count

if __name__ == "__main__":

    n = int(eval(input()))
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

# Optimized solution
def solve(n, p_list):

    count = 0
    j = 2 * 10**5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(eval(input()))
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)
# Original solution
N = int(eval(input()))
P = list(map(int, input().split( )))
c = 1
for i in range(1,N):
    v = min(set(P[:i]))
    if v >= P[i]:
        c += 1
print(c)

# Optimized solution
N = int(eval(input()))
P = list(map(int, input().split( )))
c = 1
v = P[0]
for i in range(1,N):
    if v >= P[i]:
        c += 1
        v = P[i]
print(c)
# Original solution
N = int(eval(input()))
P = list(map(int, input().split()))

cnt = 0
for i in range(N):
    flag = False
    for j in range(0, i):
        if P[i] <= P[j]:
            #print(":", i, P[i], P[j])
            continue
        else:
            flag = True
            break
    if flag:
        continue
    else:
        #print("::", i, P[i])
        cnt += 1

print(cnt)

# Optimized solution
N = int(eval(input()))
P = list(map(int, input().split()))

cnt = 0
last = float('inf')
for i in range(N):
    if P[i] < last:
        cnt += 1
        last = P[i] 

print(cnt)
# Original solution
N=int(eval(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)

# Optimized solution
N=int(eval(input()))
P=list(map(int,input().split()))

ans=1
m=P[0]
for i in range(1,N):
    m=min(m,P[i-1])
    if m>P[i]:
        ans+=1
print(ans)
# Original solution
n = int(eval(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)

# Optimized solution
n = int(eval(input()))
p = list(map(int, input().split()))

count = 1
min = p[0]
for i in range(1,n):
  if(min >= p[i]):
    min = p[i]
  if(min >= p[i]):
    count += 1
print(count)
# Original solution
n=int(eval(input()))
p =list(map(int,input().split()))
ans = 0
for i in range(n):
    if min(p[:i+1]) == p[i]:
        ans +=1

print(ans)


# Optimized solution
n=int(eval(input()))
p =list(map(int,input().split()))
ans = 0
x = p[0]
for i in range(n):
    if x >= p[i]:
        ans +=1
        x = p[i]

print(ans)
# Original solution
s=input().split()
n=int(s[0])
s=input().split()
lis=[]
out=0
for i in range(n):
    lis.append(int(s[i]))
    if min(lis)>=int(s[i]):
        out+=1
print(out)

# Optimized solution
s=input().split()
n=int(s[0])
s=input().split()
mini=10000000
out=0
for i in range(n):
    if mini>=int(s[i]):
        mini=int(s[i])
        out+=1
print(out)
# Original solution
N=int(eval(input()))
P=list(map(int, input().split()))

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

# Optimized solution
N=int(eval(input()))
P=list(map(int, input().split()))

cnt=1

if N==1:
    print((1))
elif N==2:
    if P[1] < P[0]:
        print((2))
    else:
        print((1))
else:
    tmp = P[0]
    if P[1] <= P[0]:
        cnt +=1
    for i in range(2,N):
        tmp = min(P[i-1],tmp)
        if P[i] <= tmp:
            cnt+=1
    print(cnt)
# Original solution
N=int(eval(input()))
List=list(map(int,input().split()))

counter=0
for i in range(N):
  Pj_list=[]
  for j in range(i+1):
    Pj_list.append(List[j])
  Mi=min(Pj_list)
  if Mi==List[i]:
    counter+=1
print(counter)

# Optimized solution
N=int(eval(input()))
List=list(map(int,input().split()))

counter=0
mj=N
for i in range(N):
  if mj>List[i]:
    mj=List[i]
  if List[i]==mj:
    counter+=1
print(counter)
# Original solution
def pred(i, lst, offset):
  for cmpd in lst[offset:i+1]:
    if lst[i] > cmpd:
      return False
  return True

n = int(eval(input()))
p = [int(m) for m in input().split(' ')]

sum = 0
offset = 0
for i in range(n):
  if pred(i, p, offset):
    sum += 1
    offset = i

print(sum)

# Optimized solution
def pred(i, lst, offset):
  for cmpd in lst[offset:i+1]:
    if lst[i] > cmpd:
      return False
  return True

n = int(eval(input()))
p = [int(m) for m in input().split(' ')]

sum = 0
minimum = n + 1
for i in range(n):
  if p[i] < minimum:
    sum += 1
    minimum = p[i]

#sum = 0
#offset = 0
#for i in range(n):
#  if pred(i, p, offset):
#    sum += 1
#    offset = i

print(sum)
# Original solution
n = eval(input())
p = list(int(i) for i in input().split())
count = 1
for i in range(1,len(p)):
  if(p[i] <= min(p[0:i])):
    count += 1

print(count) 


# Optimized solution
n = eval(input())
p = list(int(i) for i in input().split())
count = 1
min_num = min(p[0:1])
for i in range(1,len(p)):
  if(p[i] <= min_num):
    count += 1
    min_num = p[i]

print(count)
# Original solution
n = int(eval(input()))
p = list(map(int,input().split()))
count = [0] * n
for i in range(n):
    for j in range(i+1):
        if p[i] <= p[j]:
            count[i] = 1
        else:
            count[i] = 0
            break
print((sum(count)))

# Optimized solution
n = int(eval(input()))
p = list(map(int,input().split()))
count = 0
p_min = p[0]
for i in range(n):
    if p_min >= p[i]:
        count+=1
    p_min = min(p[i],p_min)
print(count)
# Original solution
import sys

n, *p = list(map(int, sys.stdin.read().split()))

def main():
    mi = float('inf')
    res = 0
    for i in range(n):
        if p[i] <= mi:
            res += 1
            mi = p[i]
    return res

if __name__ == '__main__':
    ans = main()
    print(ans)

# Optimized solution
import sys

n, *p = list(map(int, sys.stdin.read().split()))

def main():
    m = float('inf')
    cnt = 0
    for x in p:
        if x > m: continue
        cnt += 1
        m = x
    print(cnt)

if __name__ ==  '__main__':
    main()
# Original solution
N = int(eval(input()))
P_list = list(map(int, input().split()))
cnt = 0
for i, P in enumerate(P_list):
    for tmp_P in P_list[:i+1]:
        if P > tmp_P:
            break
    else:
        cnt += 1
print(cnt)

# Optimized solution
N = int(eval(input()))
P_list = list(map(int, input().split()))
cnt = 0
min_num = P_list[0]
for P in P_list:
    if min_num >= P:
        cnt += 1
        min_num = P
print(cnt)
# Original solution
n = int(eval(input()))
p = list(map(int,input().split()))

count = 0
for i, elem in enumerate(p):
    if min(p[:i+1]) == elem:
        count += 1

print(count)


# Optimized solution
n = int(eval(input()))
p = list(map(int,input().split()))

count = 0
p_min = p[0]

for elem in p:
    if elem <= p_min:
        count += 1
        p_min = elem

print(count)
# Original solution
N = int(eval(input()))
S = list(map(int,input().split()))
counter = int(0)
tmp = int(0)
breakPoint = int(0)

if N == 1:
  print("1")

else:
  for i in S:
    tmp = tmp + 1
    if tmp == 1:
      counter = counter + 1
      continue
    for j in range(0,tmp-1):
      if S[j] < i:
        breakPoint = 1
        break
      else:
        continue
    if breakPoint == 0:
      counter = counter + 1
    else:
      breakPoint = 0
  print(counter)

# Optimized solution
N = int(eval(input()))
S = list(map(int,input().split()))
counter = int(0)
minNum = S[0]

if N == 1:
  print("1")

else:
  for i in range(N):
    if minNum >= S[i]:
      minNum = S[i]
      counter = counter + 1
    
  print(counter)
# Original solution
n = int(eval(input()))
p = [int(i) for i in input().split()]

p_min = [p[0],] * n

for i in range(1,n):
    if p_min[i-1] > p[i]:
        p_min[i] = p[i]
    else:
        p_min[i] = p_min[i-1]

print((sum([1 for i in range(n) if p_min[i] >= p[i]])))

# Optimized solution
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    P = list(map(int, readline().split()))
    cur = N + 1
    ans = 0
    for x in P:
        if cur > x:
            ans += 1
            cur = x

    print(ans)

if __name__ == '__main__':
    main()
# Original solution
N = int(eval(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)

# Optimized solution
N = int(eval(input()))
P = list(map(int, input().split()))

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

print(ans)