AtCoder Beginner Contest 152 - Low Elements

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-----
5
4 2 5 1 3

-----Sample Output-----
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.

Source: atcoder | Difficulty: EASY


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


n = int(input())
p = [int(x) for x in input().split()]
s = 0
t = n + 1
for c in range(n):
	if p[c] < t:
		s += 1
		t = p[c]
print(s)


(N, P) = (int(input()), list(map(int, input().split())))
for i in range(1, N):
	P[i] = min(P[~-i], P[i])
print(len(set(P)))


n = int(input())
p = list(map(int, input().split()))
low = 3 * 10 ** 5
cnt = 0
for x in p:
	if x < low:
		cnt += 1
		low = x
print(cnt)


N = int(input())
L = list(map(int, input().split()))
m = N + 1
c = 0
for i in L:
	if m > i:
		m = i
		c += 1
print(c)


N = int(input())
lst = [int(n) for n in input().split()]
m = 999999
cnt = 0
for l in range(N):
	m = min(m, lst[l])
	if m == lst[l]:
		cnt += 1
print(cnt)


n = int(input())
tmp = 2 ** 60
ans = 0
for i in input().split(' '):
	tmp = min(tmp, int(i))
	if int(i) == tmp:
		ans += 1
print(ans)


n = int(input())
p = input().split()
cnt = 0
min = int(p[0])
for i in p:
	if int(i) <= min:
		cnt = cnt + 1
		min = int(i)
print(cnt)


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


(_, p) = open(0)
m = 10 ** 18
c = 0
for p in map(int, p.split()):
	c += p < m
	m = min(m, p)
print(c)


N = int(input())
A = list(map(int, input().split()))
count = 0
mi = N + 1
for a in A:
	if a < mi:
		count += 1
		mi = a
print(count)


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)


n = int(input())
a = tuple(map(int, input().split()))
min_ = n + 1
ans = 0
for i in a:
	if i < min_:
		min_ = i
		ans += 1
print(ans)


N = int(input())
S = list(map(int, input().split()))
cnt = 1
min_n = S[0]
for n in S[1:]:
	if n <= min_n:
		min_n = n
		cnt += 1
print(cnt)


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


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


n = int(input())
p = list(map(int, input().split()))
MIN = 10 ** 10
cnt = 0
for i in p:
	if i <= MIN:
		MIN = i
		cnt += 1
print(cnt)


(n, *ps) = map(int, open(0).read().split())
mp = ps[0]
cou = 1
for p in ps[1:]:
	if mp > p:
		cou += 1
		mp = p
print(cou)


n = int(input())
l = map(int, input().split())
ans = 0
for i in l:
	if n >= i:
		ans += 1
		n = i
print(ans)


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


n = int(input())
alst = list(map(int, input().split()))
min_ = alst[0]
ans = 1
for a in alst[1:]:
	if a <= min_:
		ans += 1
		min_ = a
print(ans)


n = int(input())
pn = [int(num) for num in input().split()]
maxpj = n + 1
answer = 0
for pi in pn:
	if pi < maxpj:
		answer += 1
		maxpj = pi
print(answer)


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


(n, p) = (int(input()), list(map(int, input().split())))
for i in range(1, n):
	p[i] = min(p[~-i], p[i])
print(len(set(p)))


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


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


N = int(input())
P_ls = list(map(int, input().split(' ')))
(rst, min_val) = (0, 10 ** 6)
for i in P_ls:
	if min_val >= i:
		rst += 1
		min_val = i
print(rst)


N = int(input())
P = list(map(int, input().split()))
Q = [P[0]]
for i in P[1:]:
	if i < Q[-1]:
		Q.append(i)
print(len(Q))


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


N = int(input())
P = list(map(int, input().split()))
ans = N
min_val = N
for i in range(N):
	target = P[i]
	if target < min_val:
		min_val = target
	if min_val < target:
		ans -= 1
print(ans)


n = int(input())
plist = list(map(int, input().split()))
tmpmin = 2 * 10 ** 5
count = 0
for i in range(n):
	if tmpmin >= plist[i]:
		tmpmin = plist[i]
		count += 1
print(count)


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)


n = int(input())
L = list(map(int, input().split()))
ans = 0
Min = 2 * 10 ** 5 + 1
for i in L:
	if i < Min:
		ans += 1
		Min = i
print(ans)


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


n = int(input())
a = list(map(int, input().split()))
c = 0
j = float('inf')
for i in a:
	if i < j:
		c += 1
	j = min(j, i)
print(c)


import sys
(n, *p) = map(int, sys.stdin.read().split())
c = 0
minp = p[0]
for i in p:
	if i <= minp:
		c += 1
		minp = i
print(c)


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


n = int(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)


n = int(input())
P = list(map(int, input().split()))
(ans, now) = (0, float('inf'))
for p in P:
	if now > p:
		now = p
		ans += 1
print(ans)


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


import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
input = sys.stdin.readline

def RD():
	return input().rstrip()

def F():
	return float(input().rstrip())

def I():
	return int(input().rstrip())

def MI():
	return map(int, input().split())

def MF():
	return map(float, input().split())

def LI():
	return list(map(int, input().split()))

def TI():
	return tuple(map(int, input().split()))

def LF():
	return list(map(float, input().split()))

def Init(H, W, num):
	return [[num for i in range(W)] for j in range(H)]

def main():
	N = I()
	if N == 1:
		print(1)
		return
	L = LI()
	res = 1
	temp = L[0]
	for i in L[1:]:
		if temp >= i:
			res += 1
			temp = i
	print(res)

def __starting_point():
	main()
__starting_point()


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


N = int(input())
P = map(int, input().split())
r = 0
x = 200001
for num in P:
	if x >= num:
		r += 1
		x = num
print(r)


N = int(input())
l = list(map(int, input().split()))
counter = 0
curmin = 1000000000.0
for i in l:
	curmin = min(curmin, i)
	if i == curmin:
		counter += 1
print(counter)


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


n = int(input())
p = [int(x) for x in input().split()]
a = p[0]
cnt = 1
for i in p:
	if i < a:
		cnt += 1
		a = i
print(cnt)


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)


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


(n, *p) = map(int, open(0).read().split())
c = 0
for q in p:
	c += q <= n
	n = min(n, q)
print(c)


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


_ = input()
p = list(map(int, input().split()))
m = float('inf')
c = 0
for i in p:
	c += i <= m
	m = min(m, i)
print(c)


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


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)


n = int(input())
a = list(map(int, input().split()))
b = []
mx = 10 ** 10
cnt = 0
for i in a:
	mx = min(mx, i)
	if mx >= i:
		cnt += 1
print(cnt)


n = int(input())
p = list(map(int, input().split()))
cnt = 0
m = 10 ** 9
for i in p:
	if i <= m:
		cnt += 1
		m = i
print(cnt)


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


N = int(input())
A = list(map(int, input().split()))
t = 10 ** 10
c = 0
for a in A:
	if a <= t:
		c += 1
		t = a
print(c)


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)


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)


n = int(input())
a = [*map(int, input().split())]
(count, m) = (0, n + 1)
for i in a:
	if m > i:
		m = i
		count += 1
print(count)


N = int(input())
P = map(int, input().split())
cnt = 0
m = N + 1
for p in P:
	if m >= p:
		m = p
		cnt += 1
print(cnt)


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


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


n = int(input())
p = map(int, input().split())
mi = n + 1
ans = 0
for i in p:
	if mi > i:
		mi = i
		ans += 1
print(ans)


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


N = int(input())
P = list(map(int, input().split()))
ans = 0
check = 10 ** 9 + 7
for i in range(N):
	if check > P[i]:
		ans += 1
		check = P[i]
print(ans)


N = int(input())
P = list(map(int, input().split()))
MIN = 10 ** 6
res = 0
for i in P:
	if i <= MIN:
		MIN = i
		res += 1
print(res)


N = int(input())
P = map(int, input().split())
ans = 0
mv = N
for p in P:
	if p <= mv:
		ans += 1
		mv = p
print(ans)


_ = input()
a = list(map(int, input().split()))
d = 100000000
ret = 0
for i in a:
	if i < d:
		ret += 1
		d = i
print(ret)


N = int(input())
P = list(map(int, input().split()))
cnt = 0
for p in P:
	cnt += p <= N
	N = min(N, p)
print(cnt)


N = int(input())
A = list(map(int, input().split()))
(x, r) = (3 * 10 ** 5, 0)
for a in A:
	if a <= x:
		(x, r) = (a, r + 1)
print(r)


a = int(input())
b = list(map(int, input().split()))
k = 1
v = b[0]
for i in range(a):
	if b[i] < v:
		k += 1
		v = b[i]
print(k)


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)


n = int(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)


N = int(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)


import sys
input = sys.stdin.readline

def main():
	numbers = []
	n = int(input())
	numbers = list(map(int, input().split()))
	small = 0
	dp = []
	for (idx, data) in enumerate(numbers):
		if idx == 0:
			small = data
			dp.append(data)
		elif data < small:
			small = data
			dp.append(data)
		else:
			continue
	print(len(dp))

def __starting_point():
	main()
__starting_point()


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


def main():
	n = int(input())
	p = [int(v) for v in input().split()]
	ans = 1
	sofar = p[0]
	for i in range(1, len(p)):
		sofar = min(p[i - 1], sofar)
		if p[i] < sofar:
			ans += 1
	return ans

def __starting_point():
	print(main())
__starting_point()


n = int(input())
p = list(map(int, input().split()))
a = n
cnt = 0
for i in p:
	if i <= a:
		cnt += 1
	a = min(a, i)
print(cnt)


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


a = int(input())
lis = list(map(int, input().split()))
min = float('inf')
ans = 0
for i in lis:
	if min >= i:
		ans += 1
		min = i
print(ans)


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


N = int(input())
S = list(map(int, input().split()))
Min = 2 * 10 ** 5
ans = 0
for i in S:
	if Min >= i:
		Min = i
		ans += 1
print(ans)


N = int(input())
a = list(map(int, input().split()))
b = 1
c = a[0]
for i in range(N - 1):
	if c > a[i + 1]:
		b += 1
		c = a[i + 1]
print(b)


N = int(input())
P = list(map(int, input().split()))
S = sorted(P, reverse=True)
cn = 0
L = []
for i in range(N):
	if i == 0:
		cn = cn + 1
		L.append(P[i])
	elif P[i] > L[0]:
		continue
	else:
		cn = cn + 1
		L.append(P[i])
		L.pop(0)
print(cn)


N = int(input())
p = map(int, input().split())
P = list(p)
a = P[0]
c = 0
for i in range(N):
	if P[i] <= a:
		a = P[i]
		c += 1
print(c)


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


N = int(input())
P = list(map(int, input().split()))
mn = 10 ** 6
ans = 0
for p in P:
	if p < mn:
		ans += 1
		mn = p
print(ans)


n = int(input())
pl = list(map(int, input().split()))
min_num = 1001001001
ans = 0
for p in pl:
	if p <= min_num:
		ans += 1
		min_num = p
print(ans)


a = int(input())
b = list(map(int, input().split()))
ans = 0
g = a + 1
for c in b:
	if c < g:
		ans += 1
		g = c
print(ans)


n = int(input())
A = list(map(int, input().split()))
m = A[0]
c = 0
for a in A:
	m = min(m, a)
	if m == a:
		c += 1
print(c)


N = int(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)


(n, *l) = map(int, open(0).read().split())
(t, c) = (n + 1, 0)
for i in l:
	if i < t:
		t = i
		c += 1
print(c)


N = int(input())
P = list(map(int, input().split()))
dp = [0] * N
dp[0] = P[0]
ans = 1
for i in range(1, N):
	if P[i] <= dp[i - 1]:
		dp[i] = P[i]
		ans += 1
	else:
		dp[i] = dp[i - 1]
print(ans)
return


N = int(input())
P = list(map(int, input().split()))
m = P[0]
k = 1
for j in range(N - 1):
	i = j + 1
	if m >= P[i]:
		k += 1
	m = min(m, P[i])
print(k)


n = int(input())
P = list(map(int, input().split()))
ans = 0
m = 200002
for p in P:
	if p <= m:
		m = p
		ans += 1
print(ans)


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


(n, *a) = map(int, open(0).read().split())
ans = 1
s = a[0]
for i in range(1, n):
	if a[i] <= s:
		ans += 1
	s = min(s, a[i])
print(ans)


(n, *p) = map(int, open(0).read().split())
(ans, mini) = (0, p[0])
for i in p:
	if i <= mini:
		ans += 1
		mini = i
print(ans)


n = int(input())
p = [int(s) for s in input().split()]
ans = 1
min_val = p[0]
for i in range(1, n):
	if p[i] <= min_val:
		min_val = p[i]
		ans += 1
print(ans)


N = int(input())
A = list(map(int, input().split()))
m = N + 1
ct = 0
for i in range(N):
	if A[i] < m:
		ct += 1
		m = A[i]
print(ct)


n = int(input())
A = list(map(int, input().split()))
comp = 10 ** 6
ans = 0
for i in A:
	if i < comp:
		comp = i
		ans += 1
print(ans)


(_, p) = open(0)
m = 9000000000.0
c = 0
for p in map(int, p.split()):
	if p < m:
		c += 1
		m = p
print(c)


N = int(input())
a = list(map(int, input().split()))
x = a[0]
y = 0
for i in range(N):
	if a[i] <= x:
		y += 1
		x = a[i]
print(y)


n = int(input())
li = list(map(int, input().split()))
m = li[0]
ans = 0
for x in li:
	if x <= m:
		ans += 1
		m = x
print(ans)


N = int(input())
P = list(map(int, input().split()))
A = 10 ** 100
ans = 0
for i in P:
	A = min(A, i)
	if A == i:
		ans += 1
print(ans)


N = int(input())
P = list(map(int, input().split()))
M = N + 1
K = 0
for a in P:
	if a <= M:
		M = a
		K += 1
print(K)


N = int(input())
P = list(map(int, input().split()))
num = 100000000
ans = 0
for i in P:
	if num > i:
		ans += 1
		num = i
print(ans)


n = int(input())
p = [int(x) for x in input().split()]
a = n + 1
ans = 0
for i in range(n):
	if a >= p[i]:
		ans += 1
	a = min(a, p[i])
print(ans)


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


n = int(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)


N = int(input())
P = [int(i) for i in input().split()]
p = N
ans = 0
for i in range(N):
	if p >= P[i]:
		ans += 1
		p = P[i]
print(ans)


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


N = int(input())
P = list(map(int, input().split()))
mini = N + 1
cnt = 0
for i in P:
	if mini > i:
		cnt += 1
		mini = i
print(cnt)


n = int(input())
p = list(map(int, input().split()))
mi = p[0]
res = 0
for v in p:
	mi = min(v, mi)
	if mi == v:
		res += 1
print(res)


N = int(input())
P = map(int, input().split())
m = next(P)
c = 1
for p in P:
	if p <= m:
		m = p
		c += 1
print(c)


(n, *p) = map(int, open(0).read().split())
m = p[0]
ans = 0
for p_i in p:
	if p_i <= m:
		ans += 1
		m = p_i
print(ans)


n = int(input())
mini = n + 1
count = 0
for p in map(int, input().split()):
	if p < mini:
		count += 1
		mini = p
print(count)


N = int(input()) + 1
A = map(int, input().split())
ans = 0
for a in A:
	if N > a:
		ans += 1
	N = min(N, a)
print(ans)


from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

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


n = int(input())
p = list(map(int, input().split()))
a = p[0]
c = 0
for num in p:
	if a >= num:
		c += 1
		a = num
print(c)


N = int(input())
P = list(map(int, input().split()))
m = 2 * 10 ** 5
a = 0
for p in P:
	if p <= m:
		a += 1
	m = min(m, p)
print(a)


N = int(input())
P = [int(i) for i in input().split()]
ans = 0
a = N
for i in range(N):
	if P[i] <= a:
		ans += 1
		a = min(a, P[i])
		continue
	a = min(a, P[i])
print(ans)


now_min = 1 << 20
n = int(input())
ans = 0
for p in map(int, input().split()):
	if p < now_min:
		ans += 1
		now_min = p
print(ans)


n = int(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)


N = int(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)


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


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


n = int(input())
P = tuple(map(int, input().split()))
ans = 0
m = n + 1
for p in P:
	if m > p:
		ans += 1
	m = min(m, p)
print(ans)


n = int(input())
a = list(map(int, input().split()))
cnt = 0
mina = a[0]
for i in a:
	if i <= mina:
		cnt += 1
		mina = i
print(cnt)


n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n):
	if i == 0:
		ans = ans + 1
		x = p[0]
	elif x < p[i]:
		pass
	else:
		ans = ans + 1
		x = p[i]
print(ans)


n = int(input())
a = map(int, input().split())
ans = 0
c = n + 1
for i in a:
	c = min(i, c)
	if c == i:
		ans += 1
print(ans)


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


N = int(input())
P_list = list(map(int, input().split()))
num_min = 2 * 10 ** 5
ans = 0
for i in P_list:
	if num_min >= i:
		num_min = i
		ans += 1
	else:
		continue
print(ans)


n = int(input())
L = list(map(int, input().split()))
mini = L[0]
ans = 0
for l in L:
	if mini >= l:
		ans += 1
		mini = l
print(ans)


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


n = int(input())
p_i = [int(i) for i in input().split()]
bk = p_i[0]
cnt = 0
for i in p_i:
	if i <= bk:
		bk = i
		cnt += 1
print(cnt)


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


a = int(input())
x = list(map(int, input().split()))
ans = 0
chk = 10 ** 10
for i in range(a):
	if x[i] < chk:
		ans = ans + 1
		chk = x[i]
print(ans)


n = int(input())
l = list(map(int, input().split()))
ans = 0
p = 10 ** 10
for i in l:
	if i < p:
		ans += 1
		p = min(p, i)
print(ans)


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


(_, p) = open(0)
m = 9000000000.0
c = 0
for p in map(int, p.split()):
	c += p < m
	m = min(m, p)
print(c)


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


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


n = int(input())
s = list(map(int, input().split()))
i = 1
l = s[0]
for k in range(1, n):
	if s[k] < l:
		i += 1
		l = s[k]
print(i)


n = int(input())
P = [int(i) for i in input().split()]
cur = n + 1
ans = 0
for p in P:
	if p < cur:
		ans += 1
		cur = p
print(ans)


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


(n, *p) = map(int, open(0).read().split())
for i in range(1, n):
	p[i] = min(p[~-i], p[i])
print(len(set(p)))


n = int(input())
a = list(map(int, input().split()))
r = 1
m = a[0]
for i in a[1:]:
	if m >= i:
		r += 1
	m = min(i, m)
print(r)


n = int(input())
p = [int(i) for i in input().split()]
for i in range(n):
	if i != 0:
		p[i] = min(p[i - 1], p[i])
print(len(set(p)))


import sys
import copy
import math
import itertools
import numpy as np
N = int(input())
P = [int(c) for c in input().split()]
min = P[0]
cnt = 0
for i in range(N):
	if min >= P[i]:
		min = P[i]
		cnt += 1
print(cnt)


n = int(input())
p = list(map(int, input().split()))
ans = 0
m = 10 ** 18
for i in p:
	if m > i:
		m = i
		ans += 1
print(ans)


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


import sys
N = int(input())
P = list(map(int, input().split()))
m = 100000000000000
cnt = 0
for i in range(N):
	if P[i] <= m:
		cnt += 1
	m = min(m, P[i])
print(cnt)


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


n = int(input())
p = list(map(int, input().split()))
check = 200001
cnt = 0
for i in p:
	if check > i:
		check = i
		cnt += 1
print(cnt)


N = int(input())
M = 0
for P in map(int, input().split()):
	if P <= N:
		N = P
		M += 1
print(M)


N = int(input())
P = list(map(int, input().split()))
c = 10 ** 20
con = 0
for i in range(N):
	if c > P[i]:
		con += 1
		c = P[i]
print(con)


n = int(input())
P = list(map(int, input().split()))
ans = 0
b = 10 ** 9
for i in range(n):
	if P[i] < b:
		ans = ans + 1
		b = P[i]
print(ans)


def main():
	N = int(input())
	tmp = 200001
	ans = 0
	A = list(map(int, input().split()))
	for a in A:
		if a < tmp:
			ans += 1
			tmp = a
	print(ans)

def __starting_point():
	main()
__starting_point()


N = int(input())
P = list(map(int, input().split()))
a = 0
for p in P:
	if p <= N:
		a += 1
		N = p
print(a)


input()
P = map(int, input().split())
(ans, mn) = (0, 2 * 10 ** 5)
for x in P:
	if mn >= x:
		ans += 1
		mn = x
print(ans)


n = int(input())
p = list(map(int, input().split()))
x = 2 * 10 ** 5 + 1
c = 0
for i in p:
	if i < x:
		x = i
		c += 1
print(c)


n = int(input())
r = 0
for x in map(int, input().split()):
	if x <= n:
		n = x
		r += 1
print(r)


def N():
	return int(input())

def L():
	return list(map(int, input().split()))

def NL(n):
	return [list(map(int, input().split())) for i in range(n)]
mod = pow(10, 9) + 7
import sys
import math
import collections
n = N()
p = L()
mi = sys.maxsize
cnt = 0
for i in p:
	if i <= mi:
		cnt += 1
		mi = i
print(cnt)


n = int(input())
ps = list(map(int, input().split()))
mn = ps[0]
res = 0
for p in ps:
	mn = min(mn, p)
	if mn >= p:
		res += 1
print(res)


n = int(input())
l = map(int, input().split())
res = 0
mi = n + 1
for i in l:
	if mi > i:
		res += 1
		mi = i
print(res)


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


n = int(input())
p_l = list(map(int, input().split()))
m_p_l = []
min_p = float('inf')
for (i, p) in enumerate(p_l):
	min_p = min(min_p, p)
	m_p_l.append(min_p)
ans = 0
for (i, p) in enumerate(p_l):
	if p == m_p_l[i]:
		ans += 1
print(ans)


N = int(input())
s = list(map(int, input().split()))
temp = 1000000
count = 0
for i in range(N):
	if temp > s[i]:
		count = count + 1
		temp = s[i]
print(count)


n = int(input())
p = list(map(int, input().split()))
count = 0
a = p[0]
for x in range(len(p)):
	if p[x] <= a:
		count += 1
		a = p[x]
print(count)


def resolve():
	n = int(input())
	p = tuple(map(int, input().split()))
	min_p = p[0]
	cnt = 1
	for i in range(1, n):
		if min_p > p[i]:
			min_p = p[i]
			cnt += 1
	print(cnt)
resolve()


n = int(input())
P = list(map(int, input().split()))
minSoFar = 2 * 10 ** 5 + 1
ans = 0
for i in range(n):
	if P[i] < minSoFar:
		ans += 1
	minSoFar = min(minSoFar, P[i])
print(ans)


n = int(input())
ps = [int(i) for i in input().split()]
now = ps[0]
cnt = 1
for p in ps:
	if p < now:
		cnt += 1
		now = p
print(cnt)


N = int(input())
A = list(map(int, input().split()))
core = 1
b = A[0]
for i in range(1, N):
	if b > A[i]:
		core += 1
		b = A[i]
	else:
		pass
print(core)


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


N = int(input())
ans = 0
champ = 10 ** 6
for p in list(map(int, input().split())):
	if p < champ:
		ans += 1
		champ = p
print(ans)


N = int(input())
P = list(map(int, input().split()))
mini = 2 * 10 ** 5
ans = 0
for i in P:
	if i <= mini:
		ans += 1
		mini = i
print(ans)


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


n = int(input())
a = list(map(int, input().split()))
b = 2 * 10 ** 5
cnt = 0
for i in a:
	if b >= i:
		cnt += 1
		b = i
print(cnt)


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


n = int(input())
p = []
p = [int(x) for x in input().split()]
l = p[0]
ans = 1
for i in p:
	if i < l:
		l = i
		ans += 1
print(ans)


N = int(input())
A = [int(x) for x in input().split()]
mi = 10 ** 9
cnt = 0
for i in A:
	if mi > i:
		cnt += 1
		mi = i
print(cnt)


n = int(input())
p = [int(j) for j in input().split()]
t = 10 ** 18
ans = 0
for i in p:
	if i <= t:
		ans += 1
		t = i
print(ans)


n = int(input())
p = list(map(int, input().split()))
ans = 0
m = 2 * 10 ** 5 + 1
for i in range(n):
	if m > p[i]:
		m = p[i]
		ans += 1
print(ans)


n = int(input())
l = list(map(int, input().split()))
t = n + 1
cnt = 0
for x in l:
	if x < t:
		t = x
		cnt += 1
print(cnt)


(n, *p) = map(int, open(0).read().split())
_min = max(p)
cnt = 0
for i in p:
	_min = min(_min, i)
	if i > _min:
		cnt += 1
print(n - cnt)


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


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


import numpy as np
N = int(input())
P = [int(i) for i in input().split()]
res = 0
for (p, c_min) in zip(P, np.minimum.accumulate(P)):
	if p <= c_min:
		res += 1
print(res)


n = int(input())
p = list(map(int, input().split()))
q = 2 * 10 ** 5 + 1
cnt = 0
for i in range(n):
	if q >= p[i]:
		cnt += 1
		q = p[i]
print(cnt)


n = int(input())
num = list(map(int, input().split()))
count = 10 ** 18
ans = 0
for i in num:
	if count > i:
		count = i
		ans += 1
print(ans)


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


f = input
f()
l = map(int, f().split())
(a, m) = (0, 200001)
for i in l:
	if i < m:
		m = i
		a += 1
print(a)


a = int(input())
b = list(map(int, input().split()))
ans = 0
k = 10 ** 9 + 7
for i in range(a):
	if k >= b[i]:
		ans += 1
		k = b[i]
print(ans)


n = int(input())
p = list(map(int, input().split()))
MIN = 900000000
count = 0
for i in p:
	if i <= MIN:
		count += 1
		MIN = i
print(count)


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


n = int(input())
P = list(map(int, input().split()))
ans = 1
minp = P[0]
for p in P[1:]:
	minp = min(minp, p)
	if p <= minp:
		ans += 1
print(ans)


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


n = int(input())
lst = [int(i) for i in input().split()]
mn = lst[0]
count = 0
for d in lst:
	if mn >= d:
		count += 1
		mn = d
print(count)


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


def main():
	_ = int(input())
	P = [int(x) for x in input().split()]
	res = P[0]
	ans = 0
	for p in P:
		if p <= res:
			ans += 1
			res = p
	print(ans)

def __starting_point():
	main()
__starting_point()


(N, *P) = map(int, open(0).read().split())
m = P[0]
ans = 0
for x in P:
	if x <= m:
		m = x
		ans += 1
print(ans)


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


N = int(input())
P = tuple(map(int, input().split()))
count = 0
min_num = float('inf')
for i in P:
	if i < min_num:
		count += 1
		min_num = i
print(count)


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


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