CodeEff/ECCO huggingface dataset:
# Original solution
#!/usr/bin/env python3
import sys


def solve(N: int, P: "List[int]"):
    count=0
    mi=P[0]
    for i in range(1,N+1):
        ans=P[:i]
        if i==1:
            count+=1
            #print(i)
        else:
            if min(mi,ans[-1])==ans[-1]:
                count+=1
                mi=ans[-1]
                #print(i)
    print(count)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, P)

if __name__ == '__main__':
    main()


# Optimized solution
#!/usr/bin/env python3
import sys


def solve(N: int, P: "List[int]"):
    count=0
    mi=P[0]
    for i in range(1,N+1):
        if i==1:
            count+=1
            #print(i)
        else:
            if min(mi,P[i-1])==P[i-1]:
                count+=1
                mi=P[i-1]
                #print(i)
    print(count)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, P)

if __name__ == '__main__':
    main()
# Original solution
n=int(eval(input()))
l=list(map(int,input().split()))
ans=n
for i in range(1,n):
    for j in range(i,-1,-1):
        if l[i]>l[j]:
            ans-=1
            break
print(ans)

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


# Optimized solution
N = int(eval(input()))
P = list(map(int, input().split()))
MIN = list()
count = 0
MIN.append(P[0])
for i in range(1, N):
    MIN.append(min(MIN[i - 1], P[i]))
for i in range(0, N):
    if P[i] <= MIN[i]:
        count += 1
print(count)
# Original solution
#!/usr/bin/env python3

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

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

print(count)


# Optimized solution
#!/usr/bin/env python3

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

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

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

ans=1

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

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

ans=0
low=l[0]

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

ans = 0

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

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

print(ans)

# Optimized solution
N = int(eval(input()))
P = [int(x) for x in input().split()]
cnt=1
tmp=P[0]
for i in range(1, N):
    tmp = min(tmp, P[i-1])
    if tmp >= P[i]:
        cnt+=1
#         print(i, cnt)
        
print(cnt)
# Original solution
N = int(eval(input()))
P = [int(x) for x in input().split()]
cnt=1
tmp=P[0]
for i in range(1, N):
    tmp = min(tmp, P[i-1])
    if tmp >= P[i]:
        cnt+=1
#         print(i, cnt)
        
print(cnt)

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

cnt = 0
tmp = p[0]

for i in range(n):
    tmp = min(tmp, p[i])
    if p[i] == tmp:
        cnt += 1
print(cnt)
# Original solution
N = int(eval(input()))
P = [int(i) for i in input().split()]

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

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

mi = 1000000
cnt = 0
for i in range(N):
	mi = min(P[i],mi)
	if P[i] <= mi:
		cnt += 1
print(cnt)
# Original solution
N=int(eval(input()))
P=list(map(int,input().split()))
mem=set()
c=0
for i in range(N):
    if i > 0:
        if P[i] <= min(mem):
            c+=1
    else:
        c+=1
    mem.add(P[i])
print(c)

# Optimized solution
N=int(eval(input()))
P=list(map(int,input().split()))
mini=(10**5)*2
c=0
for i in range(N):
    if P[i] <= mini:
        mini=P[i]
        c+=1
print(c)
# Original solution
N = int(eval(input()))
P = list(map(int, input().split()))
cnt = 0
for n in range(N):
    if n == 0:
        cnt += 1
    else:
        L = P[:n]
        L.sort()
        if P[n] <= L[0]:
            cnt += 1
print(cnt)


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


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

m = [10**6]
for j in range(1, n):
    m.append(min(p[:j]))

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

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

m = []
a = p[0]
for j in range(n):
    if a >= p[j]:
        a = p[j]
        m.append(a)
    else:
        m.append(a)

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

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

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

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

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

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

cnt = 0
flag = True

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

print(cnt)

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

cnt = 1
min = P[0]
flag = True

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

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

cnt = 0
min = pow(10, 6)
flag = True

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

print(cnt)

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

cnt = 0
min = N + 1
flag = True

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

print(cnt)
# Original solution
from collections import deque
n = int(eval(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)


# Optimized solution
from collections import deque
n = int(eval(input()))
p = list(map(int,input().split()))
p_cutted = []
p_cutted = deque(p_cutted)
min_p_cutted = p[0]
ans = 0
for i in range(n):
    p_cutted.append(p[i])
    if min_p_cutted >= p[i]:
        min_p_cutted = p[i]
        ans += 1
print(ans)
# Original solution
_,p=open(0)
m=10**18
c=0
for p in map(int,p.split()):
    c+=p<m
    m=min(m,p)
print(c)

# Optimized solution
_,p=open(0)
m=9e9
c=0
for p in map(int,p.split()):c+=p<m;m=min(m,p)
print(c)
# Original solution
_,p=open(0)
m=9e9
c=0
for p in map(int,p.split()):c+=p<m;m=min(m,p)
print(c)

# Optimized solution
_,p=open(0)
m=9e9
c=0
for p in map(int,p.split()):
 if p<m:c+=1;m=p
print(c)
# Original solution
N = int(eval(input()))
P = list(map(int, input().split()))
cnt, i = 1, 0
min = P[0]
for i in range(i + 1, N):
  if min >= P[i]:
    cnt += 1
    min = P[i]
print(cnt)

# Optimized solution
N = int(eval(input()))
P = list(map(int, input().split()))
cnt = 1 # P[0] is counted forcely
min = P[0]
for p in P:
  # (1≤j≤i),Pj=>Pi
  if min > p:
    min = p
    cnt += 1
print(cnt)
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
cnt = 1
min = A[0]
for i in range(1, N):
  if min > A[i]:
    cnt += 1
    min = A[i]
print(cnt)

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

a = []
ans = 0

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

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

a = P[0]
ans = 0

for i in range(N):
  if P[i] <= a:
    a = P[i]
    ans += 1
    
print(ans)
# Original solution
def func():
    return

n = int(eval(input()))
# s = input()
# a, b = map(int, input().split())
p = list(map(int, input().split()))
# a = input().split()

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

print(cnt)

# Optimized solution
def func():
    return

n = int(eval(input()))
# s = input()
# a, b = map(int, input().split())
p = list(map(int, input().split()))
# a = input().split()

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

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


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

res = 0
aa = 0
for i in p:
    if res ==0:
        res += 1
        aa += 1
        continue
    if i <= min(p[0:aa]):
        res += 1
    aa += 1

print(res)


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

res = 0
aa = p[0]
for i in p:
     if aa >= i:
         res += 1
         aa = i

print(res)
# Original solution
l = int(eval(input()))
order = list(input().split())
for i in range(l):
    order[i] = int(order[i])

a = 0
c = 0
for i in range(l):
    for j in range(i+1):
        if order[j] >= order[i]:
            c = c + 1
        if c - 1  == i:
            a = a + 1
        if j  == i:
            c  = 0
print(a)

# Optimized solution
l  = int(eval(input()))
order = list(input().split())
for i in range(l):
    order[i] = int(order[i])


min  = order[0]
a = 0

for i in range(l):
    if order[i] <= min:
        a = a + 1
        min  = order[i]
print(a)
# Original solution
n = int(eval(input()))
*p, = list(map(int, input().split()))

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

    if flag:
        ans += 1

print(ans)


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

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

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

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

print(ans)


# Optimized solution
n = int(eval(input()))
p_list = list(map(int, input().split()))
 
mi = p_list[0]
ans = 1
for i in range(1, n):
  if mi >= p_list[i]:
    ans += 1
    mi = p_list[i]
print(ans)
# Original solution
#front small ng
def checkFront(start,a):
  nowIndex = start
  for i in range(len(a)):
    #print("hikaku",a[start],a[nowIndex])
    if(a[start] > a[nowIndex]):
      #print("out")
      return 0
    else:
      if(nowIndex == 0):
        #print("ok")
        return 1
      else:
        nowIndex -= 1

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

ans = 0

for i in range(n):
  ans += checkFront(i,a)
  #print(i,ans)
print(ans)

# Optimized solution
#front small ng
def checkFront(start,a):
  global smallest
  nowIndex = start
  if(a[start] > smallest):
      #print("out")
      return 0
  else:
    smallest = a[start]
    return 1

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

smallest = a[0]
ans = 0

for i in range(n):
  ans += checkFront(i,a)
print(ans)
# Original solution
n = int(eval(input()))
P = [int(i) for i in input().split()]
r = 1
for i in range(1, n):
    if P[i] < min(P[:i]):
        r += 1
print(r)

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

ans = 0

for k in range(N):
  # k＝０を避けるため
  s = P[0:k+1]
  min_k = min(s)
  if min_k == P[k]:
    ans += 1

print(ans)

# Optimized solution
N = int(eval(input()))
P = list(map(int,input().split()))
 
m = 10**6
ans = 0
for p in P:
    if p < m:
        m = p
        ans += 1
print(ans)
# 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 = 1
min_val = p[0]

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

count = 0
for i in range(p_num):
    for j in range(i+1):
        if p[i] > p[j]:
            break
    else:
        count += 1
        

print(count)


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

count = 1
min_num = p[0]


for i in p[1:]:
    if i < min_num:
        min_num = i
        count += 1
        

print(count)
# Original solution
n=int(eval(input()))
s=list(map(int,input().split()))
c=0
for i in range(n):
    f=True
    for j in range(0,i+1):
        if s[i-j]<s[i]:
            f=False
            break
    if f:
        c=c+1
print(c)

# Optimized solution
n=int(eval(input()))
s=list(map(int,input().split()))
c=0
m=200001
for i in range(n):
    if m>s[i]:
        c=c+1
    m=min(m,s[i])
print(c)
# Original solution
n=int(eval(input()))
list1=list(map(int,input().split()))
list2=[i for i in list1 if i<=list1[0]]
ln=[list1[0]]
for i in list2:
    if min(ln)>=i:
        ln.append(i)
print((len(ln)-1))

# Optimized solution
n=int(eval(input()))
list1=list(map(int,input().split()))
mi=list1[0]
c=0
for i in list1:
    if mi>=i:
        mi=i
        c+=1
print(c)
# Original solution
#!/usr/bin/env python3

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

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

print(cnt)

# Optimized solution
#!/usr/bin/env python3

N = int(eval(input()))
P = list(map(int, input().split()))
cnt = 0
tmp = 10 ** 10

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

print(cnt)
# Original solution
n = int(eval(input()))
a = list(map(int,input().split()))
cnt=1
for i in range(1,n):
  j = i-1;flag=0
  #print(i)
  while j>=0:
    if a[i]>a[j]:
      flag=1
      break
    j-=1
  if flag==0:
    cnt+=1
    
print(cnt)
  

# Optimized solution
n = int(eval(input()))
a = list(map(int,input().split()))
cnt=1;small=a[0]
for i in range(1,n):
  if a[i]<=small:
    #print(a[i],'--',large)
    cnt+=1
    small=a[i]
    
print(cnt)
# Original solution
n = int(eval(input()))
p = list(map(int,input().split()))
count = 1

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

# Optimized solution
n = int(eval(input()))
p = list(map(int,input().split()))
count = 1
min_p = p[0]

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

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

print(ans)

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

ans = 0
tmp = P[0]
for i in range(n):
  if P[i] <= tmp:
    ans += 1
    tmp = P[i]
  else:
    pass
print(ans)
# Original solution
N = int(eval(input()))
P = list(map(int,input().split()))
a = 0
s = 10**6

for p in P:
  if p<s:
    a+=1
  s = min(s,p)

print(a)

# Optimized solution
N = int(eval(input()))
P = list(map(int,input().split()))
a = 0
s = 10**6

for p in P:
  if p<s:
    a+=1
    s=p

print(a)
# 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()))

# N = 5
# P = [4, 2, 5, 1, 3]

ans = 0
min = 2 * 10**5
for i in range(0, N):
    # i = 1
    if min > P[i]:
        min = P[i]
    if P[i] <= min:
        ans += 1

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

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

c = 0
for i in range(N):
    flag = 1
    for j in range(i):
        if P[j] < P[i]: 
            flag = 0 
            break
    if flag:
        c += 1

print(c)

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

c = 0
for i in range(N - 1):
    f = P[i]
    l = P[i + 1]
    if f < l:
        P[i] = l
        P[i+1] = f
        c += 1

print((N - c))
# Original solution
N = int(eval(input()))
P = [int(n) for n in input().split()]
c = 0
o = sorted([i for i in range(1, N+1)], reverse=True)
if o==P:
    print(N)
else:
    while P:
        r = min(P)
        P = P[:P.index(r)]
        c += 1
    print(c)


# Optimized solution
N = int(eval(input()))
P = [int(n) for n in input().split()]
c = 0
curr = 2*10**5+1
for p in P:
    if p < curr:
        curr = p
        c += 1
print(c)
# Original solution
n=int(eval(input()))
lists=list(map(int,input().split()))
 
mn=n+1
cnt=0
for li in lists:
  if mn>li:
    mn=li
    cnt+=1
print(cnt)

# Optimized solution
n=int(eval(input()))
P=list(map(int,input().split()))
mn=2*10**5+1
cnt=0

for item in P:
  if mn>item:
    cnt+=1
    mn=item
print(cnt)
# Original solution
n = int(eval(input()))
p = list(map(int, input().split()))

c = 1
for i in range(n):
  if(i != 0 and sum([p[i] <= x for x in p[:i]]) == i):
    c += 1  
print(c)

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

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

# print(N, l)
# Pi < Pj
result = []
r = False
for i in range(1, N+1):
    count = 0
    for j in range(0, i):
        if P[i - 1] <= P[j]:
            count += 1
        else:
            break
    if count >= i:
        result.append(i)

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


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

result = 0
m = P[0]
for i in range(N):
    if P[i] <= m:
        result += 1
        m = P[i]
print(result)
# Original solution
# -*- coding: utf-8 -*-

import io
import sys
import math

def solve(n, p_lst):
    # implement process
    xmin = p_lst[0]
    cnt = 0
    for x in p_lst:
        if x <= xmin:
            cnt+=1
            xmin = x
    return cnt

def main():
    # input
    n = int(eval(input()))
    p_lst = list(map(int, input().split()))
    
    # process
    ans = str( solve(n, p_lst ) )
    
    # output
    print(ans)
    return ans
        
### DEBUG I/O ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
1
1
"""
_EXPECTED = """\
3
"""

def logd(str):
    """usage:
    if _DEB: logd(f"{str}")
    """
    if _DEB: print(f"[deb] {str}")

### MAIN ###
if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")

# Optimized solution
# -*- coding: utf-8 -*-

import io
import sys
import math

def solve(n, p_lst):
    # implement process
    xmin = p_lst[0]
    cnt = 0
    for x in p_lst:
        if x <= xmin:
            cnt+=1
            xmin = x
            if xmin == 1:
                break
    return cnt

def main():
    # input
    n = int(eval(input()))
    p_lst = list(map(int, input().split()))
    
    # process
    ans = str( solve(n, p_lst ) )
    
    # output
    print(ans)
    return ans
        
### DEBUG I/O ###
_DEB = 0   # 1:ON / 0:OFF

_INPUT = """\
1
1
"""
_EXPECTED = """\
3
"""

def logd(str):
    """usage:
    if _DEB: logd(f"{str}")
    """
    if _DEB: print(f"[deb] {str}")

### MAIN ###
if __name__ == "__main__":
    if _DEB:
        sys.stdin = io.StringIO(_INPUT)
        print("!! Debug Mode !!")

    ans = main()

    if _DEB:
        print()
        if _EXPECTED.strip() == ans.strip(): print("!! Success !!")
        else: print(f"!! Failed... !!\nANSWER:   {ans}\nExpected: {_EXPECTED}")
# Original solution
N = int(eval(input()))
P = list(map(int,input().split()))
num = 1
for i in range(1,N):
    flag = 0
    min_i = min(P[:i])
    if min_i >= P[i]:
        num += 1
print(num)

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

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

cnt = 1

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

print(cnt)

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

cnt = 0
mini = float('inf')

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

print(cnt)