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: Runtime Error

Solution code:
ln=10
bit=[0]*ln

def up(id):
    while id<ln:
        bit[id]+=1
        id+=id&(-id)
def qr(id):
    res=0
    while id:
        res+=bit[id]
        id-=id&(-id)
    return res

res=0

x=int(input())
s=list(map(int,input().split()))

st=sorted(list(set(s)),reverse=True)
dc={}
id=1
for n in st:
    dc[n]=id
    id+=1


for n in range(x):
    up(dc[s[n]])
    p=qr(dc[s[n]])
    #print(p)
    res+=int(p!=0)
    

print(res)

Submission status: Runtime Error

Solution code:
N = int(input())
a = list(input().split())
count= 0
for x,i in zip(a, range(len(a))):
  a1 = a
  a1.sort()
  a2 = a1[:i]
  if a2[-1] == x:
    pass
  else:
    count += 1
print(count)

Submission status: Runtime Error

Solution code:
N=int(input())
L=map(int,input().split())
ans=1
M=L[0]
for i in range(1,N):
  if M>=L[1]:
    M=L[1]
    ans+=1
  else:
    continue
print(ans)

Submission status: Runtime Error

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

mmin = P[0]
ans = 0
for i in range(N):
  if mmin < P[i]:
    continue
  else:
    mmin >= P[i]:
      mmin = P[i]
      ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p.at(i);
    }
    int ans = 0;
    int mini = 2000000;
    for (int j : p) {
        if (min(mini, j) == j) {
            mini = j;
            ans++;
        }
    }
    cout << ans << endl;
}

Submission status: Runtime Error

Solution code:
N = int(input())
P = list(map(int, input().split()))
ans = 0
for i in range(N):
    partP = P[:i+1]
    flag = True 
    partP.sort()[::-1]
    for p in partP:
        if P[i] <= p:
            continue
        else:
            flag = False
            break
    if flag:
        ans += 1

print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
p=list(map(int, input().split()))
def chk(i, cnt, m):
  if p[i]==1:
    return cnt+1
  elif i==n-1: 
    return cnt
  else:
    if p[i]<=m:
      return chk(i+1, cnt+1, p[i])
    else:
      return chk(i+1, cnt, m)
if p[0]==1:
  print(1)
else:
  print(chk(1, 1, p[0]))

Submission status: Runtime Error

Solution code:
n=int(input())
p=list(map(int, input().split()))
def chk(i, cnt, m):
  if p[i]==1:
    return cnt+1
  elif i==n-1: 
    return cnt
  else:
    if p[i]<m:
      return chk(i+1, cnt+1, p[i])
    else:
      return chk(i+1, cnt, m)
if p[0]==1:
  print(1)
else:
  print(chk(1, 1, p[0]))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
l = list(map(int,input().split()))
a = 10**9
ans = 0
for i in range(n):

    if l[i] <= a:
        ans += 1
         a = l[i]
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
l = list(map(int,input().split())
a = 10**9
ans = 0
if l[i] <= a:
    ans += 1
    a = l[i]
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
l = list(map(int,input().split()))
a = 10**9
ans = 0
if l[i] <= a:
    ans += 1
    a = l[i]
print(ans)

Submission status: Runtime Error

Solution code:
N = input("")
L = input("").split(" ")
suc = int(N)
min_ = 200001

for i in range(int(N)):
    if (L[i] == 1):
        continue
    if (min_ < L[i]):
        suc -= 1
        continue
    for j in range(i):
        if (L[j] < L[i]):
            suc -= 1
            break
    
print(suc)

Submission status: Runtime Error

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

N = input("")
L = input("").split(" ")
suc = N

for i in range(int(N)):
    for j in range(i):
        if (L[j] < L[i]):
            suc -= 1
            break
    
print(suc)

Submission status: Runtime Error

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=[]
cnt+0
for i in a:
  if b==[] or min(b)>=i:
    cnt+=1
    b.append(i)
  else:
    b.append(i)
print(cnt)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import math

N = int(input())

tmp = math.inf
ans = 0
for P in list(map(int,input().split())):
    if P <= tmp:
        tmp = P
        ans += 1

print(ans)

Submission status: Runtime Error

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

for i in range(n):
    if MIN > p[i]:
        ans += 1
    MIN = min(MIH, p[i])

print(ans)

Submission status: Runtime Error

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

tmpma=n
ans=0
for val in a:
  if val<=tmpmin:
    ans+=1
    tmpmin=val
print(ans)

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())
if a==0 or b==0 or (a<0 and b>0):
    print(0)
elif b<0 and (b-a)%2==0:
    print('Negative')
else:
    print('Positive')

Submission status: Runtime Error

Solution code:
a,b = map(int, input().split())
if b==0 or (a<=0 and b>=0):
    print(0)
elif (a<0 and (0-a)%2==1) or (a<0 and b<0 and (b-a)%2==0):
    print('Negative')
else:
    print('Positive')

Submission status: Runtime Error

Solution code:
N = int(input())

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

m = 1
cnt = 0

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

Submission status: Runtime Error

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: Runtime Error

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

for i in range(len(p)):
    target = p[i]
    flag = True
    if tmp < target:
        tmp = target
        continue
    for j in range(i):
        ccount += 1
        if p[i] > p[j]:
            flag = False
            break
    if flag:
        count += 1

print(count)

Submission status: Runtime Error

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

cnt = 1
after = [P[i-1] for i in range(1, N)]
for a in after:
    if a < P[i]:
        break
else:
    cnt += 1
print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

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: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
x = list(map(int, input().split()))
curr = 10 ** 9
ans = 0
for p in ppp:
    if p < curr:
        ans += 1
        curr = p
print(ans)

Submission status: Runtime Error

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 ++

print(i)

Submission status: Runtime Error

Solution code:
n=int(input())
p=list(map(int,input().split()))
cnt=0
for i in range(1,n+1):
  del p[p.index(q[i-1]):]
  cnt+=1
  if len(p)==0:
    print(cnt)
    exit()

Submission status: Runtime Error

Solution code:
import math

N = int(input())
P = list(map(int, input().split()))
m = math.inf
ans = 0

for p in P:
    if p <= m:
        ans += 1
        m = p

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from typing import List

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

aa = list(reversed(A))

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

Submission status: Runtime Error

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

result = 0
mini = [P[0]]

for i in range(N-1):
    if mini[i]>P[i+1]:
        mini.append(P[i+1])
    else:
        mini.append(mini[i])

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

print(result)

Submission status: Runtime Error

Solution code:
#include <map>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <iomanip>
#include <cmath>
#define rep(i,n) for(int i=0;i<n;i++)

//abbreviations
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vs vector<string>
#define vb vector<bool>
#define vvi vector<vector<int>>

using namespace std;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int main(){
    int N;
    cin >> N;
    vi P(N);
    int i;
    rep(i,N)cin>>P[i];

    int now = 3*pow(10,5);
    int cnt = 0;

    rep(i,N){
        if(P[i]<=now){
            cnt++;
            now = P[i];
        }
    }
    cout << cnt << endl;

    return 0;
}

Submission status: Runtime Error

Solution code:
# cook your dish here
n=int(input())
a=list(map(int,input().split()))
st=[]
for i in range(n):
    if i==0:
        st.append(a[i])
    else:
        if st[-1]>=a[i]:
            ans+=1
        else:
            st.append(a[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

min=10000000000
ans=0
       
for i in p:
  if i <= min:
    ans+=1
    min=i
print(ans)

Submission status: Runtime Error

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

min=10000000000
ans=0
       
for i in p:
  if i <= min:
    ans+=1
    min=i
print(ans)

Submission status: Runtime Error

Solution code:
N=int(input())
P=list(map(int,input().split()))
import math
min_num = math.inf
count=0
for p in P:
    if p <= min_num:
        min_num = p
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
N=int(input())
P=list(map(int,input().split()))
import math
min_num = math.inf
count=0
for p in P:
    if p <= min_num:
        min_num = p
        count += 1
print(count)

Submission status: Runtime Error

Solution code:
meow

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N; cin >> N;
  vector<long long> v(N);
  for(long long &x: v) cin >> x;
  long long count = 0;
  for (auto itr=v.begin(); itr != v.end(); ++itr){
    count += (*min_element(v.begin(), itr+1) == *itr);
  }
  cout << count << endl;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
min=2*(10**5)
cnt=0

for i in map(int,input().split())
    if min>=i:min=i
    cnt+=1

print(cnt)

Submission status: Runtime Error

Solution code:
N=int(input())
P=list(map(int,input().split()))
cnt=1
x=[]
i=0
while True:
  max=P[0]
  if max==1:
    break
  if max>=P[i+1]:
    cnt+=1
    max=P[i+1]
  i+=1
print(cnt)

Submission status: Runtime Error

Solution code:
N=int(input())
P=list(map(int,input().split()))
cnt=1
x=[]
i=0
while True:
  max=P[0]
  if max>=P[i+1]:
    cnt+=1
    max=P[i+1]
  i+=1
  if max==1:
    break
print(cnt)

Submission status: Runtime Error

Solution code:
N=int(input())
P=list(map(int,input().split()))
cnt=0
x=[]
i=0
while True:
  max=P[0]
  if max>=P[i+1]:
    cnt+=1
    max=P[i+1]
  i+=1
  if i==N-1:
    break
print(cnt)

Submission status: Runtime Error

Solution code:
n = int(input())
ls = [int(x) for x in input().split()]
a = 0
for i in range(n):
    for j in range(i):
        if ls[i] =< ls[j]:
            continue    
        else:
            a += 1
            break
print(n - a)

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

Solution code:
a= int(input())
b= input().split()
compare=b[0]
c=0

for i in range(a):
    if (compare>=int(b[i])):
        compare=int(b[i])
        c=c+1
        
print(c)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
ls = list(map(int,input().split()))
a = 0
for i in range(n):
    for j in range(i):
        if ls[i] =< ls[j]:
            continue    
        else:
            a += 1
            break
print(n - a)

Submission status: Runtime Error

Solution code:
n=int(input())
arr=list(map(int,input().split()))
total=1
if len(arr)==1:
  total=1
else:
  for i in range(0,n-1):
    if arr[i]>ar[i+1]:
      total+=1
    else:
      continue
print(total)

Submission status: Runtime Error

Solution code:
n=int(input())
arr=list(map(int,input().split()))
total=1
if len(arr)==1:
  print(1)
  exit()
else:
  for i in range(1,n):
    if arr[i-1]>ar[i]:
      total+=1
    else:
      continue
  print(total)

Submission status: Runtime Error

Solution code:
t = 0
list = []
for i in range(N):
    list.append(int(P[i]))
    m = min(list)
    if m == int(P[i]):
        t = t + 1

print(t)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
P = [int(input()) for _ in range(n)]
c = 0 
for i in range(n):
  for j in range(0,i):
    if P[i] ＞ P[j]:
      break
  else:
    c += 1
print(c)

Submission status: Runtime Error

Solution code:
from sys import stdin

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

a=p[0]
cnt=1

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

print(cnt)

Submission status: Runtime Error

Solution code:
from sys import stdin

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

a=p[0]
cnt=0

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

print(cnt)

Submission status: Runtime Error

Solution code:
from sys import stdin

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

a=p[0]
cnt=1

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

print(cnt)

Submission status: Runtime Error

Solution code:
from sys import stdin

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

a=p[0]
cnt=0

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

print(cnt)

Submission status: Runtime Error

Solution code:
a ,b= map(int,input().split())
#S = int(input())

if a > b:
    ans = [str(b)]*a
    ans = "".join(ans)
else:
    ans = [str(a)]*b
    ans = "".join(ans)
print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
m = [0]*N
s = input()
m = s.split()
c = 99999999
k = 0
for i in range(N):
	if m[i] > c:
		c = m[i]
		k +=1

print(c)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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: Runtime Error

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

counter = 0

for i in range(0,N):
    if li[i+1]>li[i]:
        counter += 1
    else:
        pass
print(counter)

Submission status: Runtime Error

Solution code:
#include<stdio.h>

int con(int a,int b){
    if(a>b){
       return b; 
    }else{
        return a;
    }
}

int main(void){
    int n;
    int count=0;
    int a[200000];
    int min=__INT_MAX__;

    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }

    for(int i=0;i<n;i++){
        min=con(min,a[i]);
        if(min==a[i]){
            count++;
        }
    }

    printf("%d",count);
}

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#ifndef LOCAL
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,mmx,tune=native")
#endif //LOCAL

#define _SCL_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#pragma comment(linker, "/STACK:256000000")

//#define push_back pb
#define first x
#define second y

#include <cassert>
#include <ciso646>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <array>
#include <bitset>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <algorithm>
#include <complex>
#include <functional>
#include <initializer_list>
#include <iterator>
#include <limits>
#include <locale>
#include <numeric>
#include <regex>
#include <string>
#include <utility>
#include <fstream>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <random>
#include <memory>
#include <chrono>

#ifdef LOCAL
//#include <vld.h>
#endif //LOCAL
using namespace std;

//typedef __int128_t ll;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef long double ld;

#define speedup cout.tie(nullptr);cin.tie(nullptr);ios_base::sync_with_stdio(false)
#define coutdouble cout<<setprecision(20);cout<<fixed

#define all(v) (v).begin(),(v).end()
#define sz(v) (int)(v).size()

#ifdef LOCAL
mt19937 rd(57322);
#else
mt19937 rd((uint)chrono::steady_clock::now().time_since_epoch().count());
#endif
/*------CommentInInteractive--------*/
#ifndef LOCAL
#define endl '\n'
#endif //LOCAL
/*----------------------------------*/
const int INF = 1000 * 1000 * 1000 + 322;
const ll LLINF = 2LL * 1000LL * 1000LL * 1000LL * 1000LL * 1000LL * 1000LL + 57;
constexpr uint MOD = 1000 * 1000 * 1000 + 7;
constexpr uint FFT_MOD = 998244353;
const int P1E6 = 1336337;
const int P1E3 = 1009;
const ll P1E14 = 100000000000031;
const ll P1E17 = 100000000000000003;
const ld PI = acosl(-1.);//3.1415926535897932384626433832795
const ld EPS = 1e-9;
/*------------------------------------------------IO_OPERATORS---------------------------------------------*/
template<typename T, typename U> inline ostream &operator << (ostream &_out, const pair<T, U> &_p) { _out << _p.first << " " << _p.second; return _out; }
template<typename T, typename U> inline istream &operator >> (istream &_in, pair<T, U> &_p) { _in >> _p.first >> _p.second; return _in; }
template<typename T> inline ostream &operator << (ostream &_out, const vector<T> &_v) { if (_v.empty()) return _out; _out << _v.front(); for (auto _it = ++_v.begin(); _it != _v.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T> inline istream &operator >> (istream &_in, vector<T> &_v) { for (auto &_i : _v) _in >> _i; return _in; }
template<typename T> inline ostream &operator << (ostream &_out, const set<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T> inline ostream &operator << (ostream &_out, const multiset<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T> inline ostream &operator << (ostream &_out, const unordered_set<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T> inline ostream &operator << (ostream &_out, const unordered_multiset<T> &_s) { if (_s.empty()) return _out; _out << *_s.begin(); for (auto _it = ++_s.begin(); _it != _s.end(); ++_it) _out << ' ' << *_it; return _out; }
template<typename T, typename U> inline ostream &operator << (ostream &_out, const map<T, U> &_m) { if (_m.empty()) return _out; _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) _out << ", (" << _it->first << ": " << _it->second << ')'; return _out; }
template<typename T, typename U> inline ostream &operator << (ostream &_out, const unordered_map<T, U> &_m) { if (_m.empty()) return _out; _out << '(' << _m.begin()->first << ": " << _m.begin()->second << ')'; for (auto _it = ++_m.begin(); _it != _m.end(); ++_it) _out << ", (" << _it->first << ": " << _it->second << ')'; return _out; }
/*--------------------------------------------------IO_FILES-----------------------------------------------*/
const char * infile =
#ifdef LOCAL
"input.txt"
#else
""
#endif //LOCAL
;
const char * outfile =
#ifdef LOCAL
""
#else
""
#endif //LOCAL
;

/*-------------------------------------------------ALLOCATOR----------------------------------------------*/
//#define ALLOC_LOCAL
#ifdef ALLOC_LOCAL
const int ML_ = 450;
char mem_[ML_ * 1024 * 1024];
size_t _ptr = 0, _magic = 21323400;
void * operator new(size_t cnt) { if (_ptr + cnt < sizeof mem_) { _ptr += cnt; return  mem_ + _ptr - cnt; } else { assert(false);  _ptr = cnt + _magic; return mem_ + _magic; } }
void operator delete(void *) {}
#endif //ALLOC_LOCAL
/*-----------------------------------------------------MATH------------------------------------------------*/
inline ll gcd(ll a, ll b) { while (b) { a %= b; swap(a, b); } return a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
inline int pwm(ll xx, ll pow, int MD) { if (pow < 0) { pow = pow % (MD - 1) + MD - 1; } ll mlt = 1; while (pow) { if (pow & 1) { mlt *= xx; mlt %= MD; } xx *= xx; pow >>= 1; xx %= MD; } return (int)mlt; }
inline ll gcdex(ll a, ll b, ll &x, ll &y) { if (b == 0) { x = 1; y = 0; return a; } ll xx, yy; ll gc = gcdex(b, a % b, yy, xx); x = xx; y = yy - (a / b) * xx; return gc; }
inline int inv(ll r, int _mod) { return pwm(r % _mod, _mod - 2, _mod); }
/*-----------------------------------------------------CODE------------------------------------------------*/



inline void solve() {
	int n;
	cin >> n;
	vector<int> v(n);
	for_each(all(v), [](int &x) {cin >> x; });
	int ans = 0;
	accumulate(all(v), INF, [&ans](int mn, int cur) { if (cur < mn) { mn = cur; ++ans; }});
	cout << ans << endl;
}

int main() {

	if (*infile != '\0')
		(void)freopen(infile, "r", stdin);
	if (*outfile != '\0')
		(void)freopen(outfile, "w", stdout);

	speedup;
	coutdouble;


	//int tst = 1;
	//srand(time(NULL));
	//cin >> tst;
	//scanf("%d", &tst);
	//while (tst-- > 0) {
	//while(true) {
	solve();
	//if ((tst & 0xF) == 0) {
	//cerr << "ok\n";
	//}
	//cerr << "/*-----------------*/\n";
	//}

#ifdef LOCAL
	cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << endl;
	while (true);
#endif // LOCAL

	return 0;
}

Submission status: Runtime Error

Solution code:
n=int(input())
num=list(map(int,input().split()))
don=[]
cnt=0
#don.append(num[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: Runtime Error

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

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

print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

count = 0
for i in range(n):
  if i == 0:
    count+=1
  elif p[i - 1] => p[i]:
    count+=1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#入力
##1*1行列
import itertools
N=int(input())#1*1の整数を格納
P=[int(i) for i in input().split()]

itertools.accumulate(P, min)

mi=10000000
x=[0]*N
for i in range(N):
    if mi>P[i]:
        x[i]=1
        mi=P[i]
print(sum(x))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a=input()
s=list(map(int,input().split()))
count=0
counter=0
for i in a:
    counter=0
    for j in range(0,i):
      if counrer==1:
        break
        if s[i]>s[j] :
            count+=1
            counter+=1
print(count)

Submission status: Runtime Error

Solution code:
a=input()
s=list(map(int,input().split()))
count=0
counter=0
for i in a:
    counter=0
    for j in range(0,i):
        if s[i]>s[j] and counter==0:
            count+=1
            counter+=1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
list_P = [int(x) for x in input().split()]

ans = 1

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

print(ans)