Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N, K = map(int, input().split())
data = [list(map(int, input().split())) for _ in range(N)]

ans = 10 ** 19
for a in range(N):
    for b in range(N):
        for c in range(N):
            for d in range(N):
                x0 = data[a][0]
                x1 = data[b][0]
                y0 = data[c][1]
                y1 = data[d][1]
                if x0 < x1 and y0 < y1:
                    count = 0
                    for i, j in data:
                        if x0 <= i <= x1 and y0 <= j <= y1:
                            count += 1
                    if count >= K:
                        ans = min(ans, (x1 - x0)*(y1 - y0))

print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
data = [list(map(int, input().split())) for _ in range(N)]

ans = 10 ** 19
for a in range(N):
    for b in range(a+1, N):
        for c in range(N):
            for d in range(c+1, N):
                x0 = data[a][0]
                x1 = data[b][0]
                y0 = data[c][1]
                y1 = data[d][1]

                if x0 > x1:
                    x0, x1 = x1, x0
                if y0 > y1:
                    y0, y1 = y1, y0

                count = 0
                for i, j in data:
                    if x0 <= i <= x1 and y0 <= j <= y1:
                        count += 1
                if count >= K:
                    ans = min(ans, (x1 - x0)*(y1 - y0))

print(ans)
### BUGGY CODE ###

from collections import deque
from numba import njit, b1, i4, i8, f8
import sys

read = sys.stdin.read
readline = sys.stdin.readline

@njit
def solve(H,W,C_h,C_w,D_h,D_w,S):
  INF = int(1e7)
  dist = [[0]*(W) for _ in range(H)]
  for i in range(H):
    for j in range(W):
      dist[i][j] = INF
  dist[C_h][C_w] = 0
  seen = [[False]*(W) for _ in range(H)]
  que1 = [(C_h,C_w)]
  que2 = []
  i,j = 0,0

  move_a = [(1,0),(0,1),(-1,0),(0,-1)]
  move_b = [(-2,-2),(-2,-1),(-2,0),(-2,1),(-2,2),(-1,-2),(-1,-1),(-1,1),(-1,2),(0,-2),(0,2),(1,-2),(1,-1),(1,1),(1,2),(2,-2),(2,-1),(2,0),(2,1),(2,2)]

  while True:
    if i==len(que1) and j==len(que2):
      break;
    while i<len(que1):
      h,w = que1[i]
      i += 1
      for dh,dw in move_a:
        nh,nw = h+dh,w+dw
        if 0<=nh<H and 0<=nw<W and S[nh][nw]!='#' and dist[nh][nw] > dist[h][w]:
          dist[nh][nw] = dist[h][w]
          que1.append((nh,nw))
      for dh,dw in move_b:
        nh,nw = h+dh,w+dw
        if 0<=nh<H and 0<=nw<W and S[nh][nw]!='#' and dist[nh][nw] > dist[h][w]+1:
          dist[nh][nw] = dist[h][w]+1
          que2.append((nh,nw))
    while j<len(que2):
      h,w = que2[j]
      j += 1
      for dh,dw in move_a:
        nh,nw = h+dh,w+dw
        if 0<=nh<H and 0<=nw<W and S[nh][nw]!='#' and dist[nh][nw] > dist[h][w]:
          dist[nh][nw] = dist[h][w]
          que1.append((nh,nw))
      for dh,dw in move_b:
        nh,nw = h+dh,w+dw
        if 0<=nh<H and 0<=nw<W and S[nh][nw]!='#' and dist[nh][nw] > dist[h][w]+1:
          dist[nh][nw] = dist[h][w]+1
          que2.append((nh,nw))
  print(dist[D_h][D_w] if dist[D_h][D_w]<INF else -1)

H,W = map(int,readline().split())
C_h,C_w = map(lambda x:int(x)-1,readline().split())
D_h,D_w = map(lambda x:int(x)-1,readline().split())
S = [readline() for _ in range(H)]
solve(H,W,C_h,C_w,D_h,D_w,S)

### FIXED CODE ###

from collections import deque

H,W = map(int,input().split())
C_h,C_w = map(lambda x:int(x)-1,input().split())
D_h,D_w = map(lambda x:int(x)-1,input().split())
S = [input() for _ in range(H)]

INF = int(1e10)
dist = [[INF]*(W) for _ in range(H)]
deq = deque()
deq.append((C_h,C_w,0))

move_a = [(1,0),(0,1),(-1,0),(0,-1)]
move_b = [(i,j)for i in range(-2,2+1) for j in range(-2,2+1) if abs(i)+abs(j)>=2]

while len(deq):
  h,w,c = deq.popleft()
  if dist[h][w] <= c:
    continue
  dist[h][w] = c
  for dh,dw in move_a:
    nh,nw = h+dh,w+dw
    if nh<0 or nw<0 or nh>=H or nw>=W:
      continue
    if S[nh][nw] == '#':
      continue
    if dist[nh][nw] > c:
      deq.appendleft((nh,nw,c))
  for dh,dw in move_b:
    nh,nw = h+dh,w+dw
    if nh<0 or nw<0 or nh>=H or nw>=W:
      continue
    if S[nh][nw] == '#':
      continue
    if dist[nh][nw] > c+1:
      deq.append((nh,nw,c+1))
  
print(dist[D_h][D_w] if dist[D_h][D_w]<INF else -1)
### BUGGY CODE ###

x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

ab = sorted(x+y for x in a for y in b)[:-k-1:-1]
c = c[:k]
abc = []
for i in ab:
    for j in c:
        abc.append(i+j)
abc.sort(reverse=True)

print(*abc[:k], sep="\n")

### FIXED CODE ###

x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

ab = sorted(x+y for x in a for y in b)[:-k-1:-1]
abc = sorted(x+y for x in ab[:k] for y in c)[:-k-1:-1]
print(*abc, sep='\n')
### BUGGY CODE ###

import sys
f = sys.stdin


board = [[0 for i in range(11)] for j in range(11)]
for i, line in enumerate(f):
    for j, c in enumerate(line.strip()):
        board[i + 1][1 + (i + 1) % 2 + j * 2] = int(c)

step = {(-1, 0 ):'L',(0, -1 ):'U',(1, 0 ):'R',(0, 1):'D'}
    
    
start = pre_loc = 1 + 1j
loc = 3 + 1j
print('R',end='')
while loc != start:
    for direct in [(pre_loc - loc) / 2 * 1j ** (i + 1) for i in range(3)]:
        if board[int(loc.imag + direct.imag)][int(loc.real + direct.real)]:
            pre_loc = loc
            loc += direct * 2
            print(step[(direct.real,direct.imag)],end='')
            break
print()

### FIXED CODE ###

import sys
f = sys.stdin

board = [[0 for i in range(11)] for j in range(11)]
for i, line in enumerate(f):
    for j, c in enumerate(line.strip()):
        board[i + 1][1 + (i + 1) % 2 + j * 2] = int(c)

step = {(-1, 0 ):'L',(0, -1 ):'U',(1, 0 ):'R',(0, 1):'D'}
    
    
start = pre_loc = 1 + 1j
loc = 3 + 1j
print('R',end='')
while loc != start:
    for direct in [(pre_loc - loc) / 2 * 1j ** (i + 1) for i in range(4)]:
        if board[int(loc.imag + direct.imag)][int(loc.real + direct.real)]:
            pre_loc = loc
            loc += direct * 2
            print(step[(direct.real,direct.imag)],end='')
            break
print()
### BUGGY CODE ###

N = str(input())
# A,B,C,D = list(map(int, input().split()))

n = 0
for i in range(len(N)+1):

    for j in range(i+1):
        if i-j<4: continue
        num = int(N[j:i])

        if (num%2019)==0: n += 1

print(n)



### FIXED CODE ###

S = [int(a) for a in input()[::-1]]
m = 2019
N = len(S)
s = 0
p = 1
X = [0] * 2019
X[0] = 1
ans = 0
for a in S:
    s = (s + a * p) % m
    ans += X[s]
    X[s] += 1
    p = p * 10 % m
 
print(ans)
### BUGGY CODE ###

# DP
def main():
    N, W = map(int, input().split())

    dp = [-1] * (W + 1)
    dp[0] = 0
    max_w = 0
    for _ in range(N):
        w, v = map(int, input().split())
        for j in range(min(max_w, W - w), -1, -1):
            if dp[j] != -1:
                dp[j + w] = max(dp[j + w], dp[j] + v)
            max_w = max(max_w, j + w)
    print(max(dp))


main()


### FIXED CODE ###

n, w = [int(e) for e in input().split()]
d = [[int(e) for e in input().split()] for i in range(n)]
t = {}
t[w] = 0
for i in range(n):
  keys = list(sorted(t.keys()))
  tw, tv = d[i]
  for j in keys:
    nw = j - tw
    if nw < 0:
      continue
    nv = t[j] + tv
    if nw in t:
      if nv > t[nw]:
        t[nw] = nv
    else:
      t[nw] = nv
print(max(t.values()))
### BUGGY CODE ###

#import sys
#input = sys.stdin.readline
def main():
    N = int( input())
    S = input()
    dp = [[0]*(N+1) for _ in range(N+1)]
    for i in range(N-1):

        for j in range(i+1, N):
            if S[i] == S[j]:
                dp[i+1][j+1] = min(dp[i][j] + 1, j-i)
    print( max( [ max(dp[i]) for i in range(N+1)]))
if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
def main():
    N = int( input())
    S = input()
    dp = [[0]*(N+1) for _ in range(N+1)]
    for i in range(N-1):
        for j in range(i+1, N):
            if S[i] == S[j]:
                dp[i+1][j+1] = min(dp[i][j] + 1, j-i)
    print( max( [ max(dp[i]) for i in range(N+1)]))
if __name__ == '__main__':
    main()
### BUGGY CODE ###

n = int(input())
ls = list(map(int, input().split()))
MOD = 10 ** 9 + 7

ans = 0
for i in range(len(ls)):
    ans += ls[i] * (sum(ls[i+1:]))
print(ans%MOD)

### FIXED CODE ###

n = int(input())
ls = list(map(int, input().split()))
MOD = 10 ** 9 + 7

ans = 0
SUM = sum(ls)
for i in range(len(ls)):
    SUM -= ls[i]
    ans += ls[i] * SUM
print(ans%MOD)
### BUGGY CODE ###

a, b = list(map(int, input().split()))

def gcd(num):
    k = []
    for i in range(1, num+1):
        if num%i == 0:
            k.append(i) 
    return k

def is_prime(num):
    for i in range(2, num):
        if num % i == 0:
            return False
    return True

ka = gcd(a)
kb = []
for i in ka:
  if b%i == 0:
    if is_prime(i):
        kb.append(i)

print(len(kb))

### FIXED CODE ###

def f(n):
    res = set()
    for i in range(2, int(n ** 0.5)):
        if n % i: continue
        while not n % i: n //= i
        res.add(i)
    return res | {n}
 
a, b = map(int,input().split())
print(len(f(a) & f(b) | {1}))
### BUGGY CODE ###

N, K = map(int, input().split())
H = list(map(int, input().split()))
k = min(N, K)
DP = [0] + [10**9] * N 
for i in range(1, N):
  DP[i] = min(DP[i-j]+abs(H[i]-H[i-j]) for j in range(1, k+1))
print(DP[N-1])

### FIXED CODE ###

import numpy as np

N, K = map(int, input().split())
H = np.array(list(map(int, input().split())) + [0]*K)

dp = np.full(N+K, 10**9, dtype=np.int64)
dp[0] = 0
for i in range(1, N):
  dp[i:i+K] = np.minimum(dp[i:i+K], dp[i-1] + np.abs(H[i:i+K] - H[i-1]))
print(dp[N-1])
### BUGGY CODE ###

import itertools
N,W= map(int,input().split())
w,v=[],[]
for i in range(N):
    tmp=list(map(int,input().split()))
    w.append((i,tmp[0]))
    v.append(tmp[1])

def check(N,W,w,v):
    cost_now=0
    for i in range(1,N+1):
        tmp=list(itertools.combinations(w,i))
        for tmptmp in tmp:
            sumsum = sum([ele[1] for ele in tmptmp])
            if sumsum <= W:
                cost_tmp=sum([v[ele[0]] for ele in tmptmp])
                if cost_tmp > cost_now:
                     cost_now = cost_tmp
    return cost_now

print(check(N,W,w,v))

### FIXED CODE ###

N,W=map(int,input().split())
w,v=[],[]
for i in range(N):
    w_tmp,v_tmp=map(int,input().split())
    w.append(w_tmp)
    v.append(v_tmp)

dp=[{} for _  in range(N+1)]
def rec(i,j):
    if j in dp[i] :
        return dp[i][j]
    if i==N:
         res=0
    elif j<w[i]:
        res=rec(i+1,j)
    else:
        res=max(rec(i+1,j),rec(i+1,j-w[i])+v[i])
    dp[i][j]=res
    
    return res

print(rec(0,W))
### BUGGY CODE ###

import numpy as np
import math
n, m = map(int, input().split())
a = np.array(list(map(int, input().split())))
for i in range(m):
    a[np.argmax(a)] /= 2
b = [math.floor(abc) for abc in a]
# sum = 0
# for i in range(n):
#     sum += math.floor(a[i])
print(np.sum(b))

### FIXED CODE ###

import heapq
n, m = map(int, input().split())
a = list(map(lambda x: int(x) * (-1), input().split()))
heapq.heapify(a)
for _ in range(m):
    tmp_min = heapq.heappop(a)
    heapq.heappush(a, (-1)*(-tmp_min//2))
print(-sum(a))
### BUGGY CODE ###

import bisect
import sys
input = lambda: sys.stdin.readline()[:-1]
n,m=map(int,input().split())
a=list(map(int,input().split()))
data=[list(map(int,input().split())) for i in range(m)]
data.sort(key=lambda tup:-tup[1])
a.sort()
for b,c in data:
	point=bisect.bisect_left(a,c)
	if point<=b:
		a[:point]=[c]*point
	else:
		a[:b]=[c]*b
		a[:point]=a[b:point]+a[:b]
print(sum(a))





### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline()[:-1]
n,m=map(int,input().split())
a0=list(map(int,input().split()))
data=[list(map(int,input().split())) for i in range(m)]
for i in a0:
	data.append([1,i])
data.sort(key=lambda tup:-tup[1])
ans=0
for num,val in data:
	if n>=num:
		n-=num
		ans+=val*num
	else:
		ans+=val*n
		break
print(ans)
### BUGGY CODE ###

from collections import deque

H, W = map(int, input().split())
# sx, sy = map(int, input().split())
# gx, gy = map(int, input().split())
# sx, sy, gx, gy = sx-1, sy-1, gx-1, gy-1
c = [input() for i in range(H)]
INF = 10**9
def bfs():
    dist = [[INF for i in range(W)] for j in range(H)]
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    q = deque()
    q.append([sx, sy])
    dist[sx][sy] = 0
    while q:
        p = q.popleft()
        if p[0] == gx and p[1] == gy:
            break
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            if 0 <= nx and nx < H and 0 <= ny and ny < W:
                if c[nx][ny] != '#' and dist[nx][ny] == INF:
                    q.append([nx, ny])
                    dist[nx][ny] = dist[p[0]][p[1]] + 1
    return dist[gx][gy]

ans = []
for i in range(H):
    for j in range(W):
        for k in range(H):
            for l in range(W):
                sx, sy = i, j
                gx, gy = k, l
                if c[sx][sy] == '#' or c[gx][gy] == '#':
                    continue
                ans.append(bfs())
                
ans = [i for i in ans if i != INF]
print(max(ans))

### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
c = [input() for i in range(H)]

INF = -1

def bfs():
    dist = [[INF for i in range(W)] for j in range(H)]
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    q = deque()
    q.append([sx, sy])
    dist[sx][sy] = 0
    while q:
        p = q.popleft()
        # if p[0] == gx and p[1] == gy:
        #     break
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            if 0 <= nx and nx < H and 0 <= ny and ny < W:
                if c[nx][ny] != '#' and dist[nx][ny] == INF:
                    q.append([nx, ny])
                    dist[nx][ny] = dist[p[0]][p[1]] + 1
    ret = -1
    for i in range(H):
        ret = max(ret, max(dist[i]))
    return ret

ans = -1
for i in range(H):
    for j in range(W):
            sx, sy = i, j
            if c[sx][sy] == '#':
                continue
            ans = max(ans, bfs())
print(ans)
### BUGGY CODE ###

n = int(input())
arr = [int(x) for x in input().split()]
res = 1
for i in range(n):
    res *= arr[i]
if res > 10**18:
    print(-1)
else:
    print(res)

### FIXED CODE ###

n = int(input())
arr = [int(x) for x in input().split()]
res = 1
flag = False
for i in range(n):
    if flag == False:
        res *= arr[i]
    if arr[i] == 0:
        print(0)
        exit()
    if res > 10**18:
        flag = True
if res > 10**18:
    print(-1)
else:
    print(res)
### BUGGY CODE ###

n = int(raw_input())
a = map(int, raw_input().split())
sm = 0

for i in range(0, len(a)):
	for j in range(i+1, len(a)):
		if a[i] > a[j]:
			temp = a[i]
			a[i] = a[j]
			a[j] = temp

for i in range(0, len(a)):
	sm = sm + a[i]


print a[0], a[len(a)-1], sm

### FIXED CODE ###

n = int(raw_input())
a = map(int, raw_input().split())

a_ = sorted(a)
sum = 0

for e in a_:
	sum += e

print "%d %d %d" %(a_[0], a_[-1], sum)
### BUGGY CODE ###

x = int(input())
c=1
for b in range(1,x):
    for p in range(2,x):
        if b**p<=x:
            c=max(c,b**p)
print(c)

### FIXED CODE ###

x = int(input())
c=1
for b in range(1,x):
    for p in range(2,x):
        if b**p<=x:
            c=max(c,b**p)
        else:break
print(c)
### BUGGY CODE ###

n=int(input())
a=[]
for i in range(n):
  b=int(input())
  a.append(b)
for i in range(n):
  s=a.copy()
  del s[i]
  print(max(s))

### FIXED CODE ###

n=int(input())
a=[]
for i in range(n):
  b=int(input())
  a.append(b)
s=a.copy()
a=sorted(a,reverse=True)

if a[0]==a[1]:
  for i in range(n):
    print(a[0])
  exit()
for i in range(n):
  if s[i]==a[0]:
    print(a[1])
  else:
    print(a[0])
### BUGGY CODE ###

import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)

N = _I()
T = [_I() for _ in range(N)]

times = 1
max_v = max(T)
while True:
    max_t = max_v * times
    for t in T:
        if max_t % t != 0:
            times += 1
            break
    else:
        print(max_t)
        break




### FIXED CODE ###

import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def _I(): return int(sys.stdin.readline())
def _F(): return float(sys.stdin.readline())
def _pf(s): return print(s, flush=True)

N = _I()
T = set([_I() for _ in range(N)])

def lcm(a,b):
    g = fractions.gcd(a,b)
    return a * b // g

l = 1
for t in T:
    l = lcm(l, t)

print(l)
### BUGGY CODE ###

#!/usr/bin/env pypy3
import collections
import itertools as it
import math
#import numpy as np
 
n  = int(input())
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))i
xy = []
for _ in range(n):
    a = int(input())
    xy.append([tuple(map(int, input().split())) for _ in range(a)])
#
# c = collections.Counter()

for i in range(2 ** n): # 嘘つき・正直者の総当り
    is_honest = [not(bool(int(s))) for s in list('{:015b}'.format(i)[-n:])]
    is_ok = True
    for i, h in enumerate(list(is_honest)): # 人の総当り
        for x, y in xy[i]: # 証言の総当り
            if is_honest[i] == False:
                continue

            x = x - 1
            v = bool(int(y))
            
            #print(is_honest[x], bool(y), v, )
            if is_honest[x] == v:
                pass
            else:
                is_ok = False
    
    if is_ok:
        i#print(is_honest)
        print(sum(is_honest))
        break


### FIXED CODE ###

#!/usr/bin/env pypy3
import collections
import itertools as it
import math
#import numpy as np
 
n  = int(input())
#  = int(input())
#  = map(int, input().split())
#  = list(map(int, input().split()))i
xy = []
for _ in range(n):
    a = int(input())
    xy.append([tuple(map(int, input().split())) for _ in range(a)])
#
# c = collections.Counter()

for i in range(2 ** n): # 嘘つき・正直者の総当り
    is_honest = [not(bool(int(s))) for s in list('{:015b}'.format(i)[-n:])]
    is_ok = True
    for i, h in enumerate(list(is_honest)): # 人の総当り
        for x, y in xy[i]: # 証言の総当り
            if is_honest[i] == False:
                continue

            x = x - 1
            v = bool(int(y))
            
            #print(is_honest[x], bool(y), v, )
            if is_honest[x] == v:
                pass
            else:
                is_ok = False
    
    if is_ok:
        i#print(is_honest)
        print(sum(is_honest))
        break
### BUGGY CODE ###

import sys
import numpy as np
from scipy.sparse.csgraph import floyd_warshall

def main():
    input = sys.stdin.readline
    N = int(input())
    
    inf = float('inf')
    d = [[inf for _ in range(N)] for _ in range(N)]
    for _ in range(N-1):
        a, b, c = map(int, input().split())
        d[a-1][b-1] = c
        d[b-1][a-1] = c

    D = floyd_warshall(np.array(d))

    Q, K = map(int, input().split())
    for _ in range(Q):
        x, y = map(int, input().split())
        print(int(D[x-1][K-1] + D[K-1][y-1]))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import deque

def dfs(start, dest, pre, d):
    if d[start][dest] > 0:
        return d[start][dest]

    for i in range(len(d)):
        if d[start][i] > 0 and i != pre:
            c = dfs(i, dest, start, d)
            if c > 0:
                return d[start][i] + dfs(i, dest, start, d)

    return 0

def main():
    input = sys.stdin.readline
    N = int(input())
    
    d = [[] for _ in range(N)]
    for _ in range(N-1):
        a, b, c = map(int, input().split())
        a, b = a - 1, b - 1
        
        d[a].append((b, c))
        d[b].append((a, c))

    Q, K = map(int, input().split())
    K -= 1

    k_dist = [0 for _ in range(N)]
    start = deque()
    start.append(K)
    while len(start) > 0:
        s = start.popleft()
        for dest, cost in d[s]:
            if k_dist[dest] > 0:
                continue

            k_dist[dest] = k_dist[s] + cost
            start.append(dest)

    for _ in range(Q):
        x, y = map(int, input().split())
        x, y = x - 1, y - 1

        print(int(k_dist[x] + k_dist[y]))


if __name__ == '__main__':
    main()
### BUGGY CODE ###

#!/usr/bin/python3
# -*- coding:utf-8 -*-

from collections import defaultdict
from queue import deque

def main():
  n = int(input())
  graph = defaultdict(list)
  
  def is_bt():
    def bfs():
      colors = [-1] * len(graph)
      visited = [False] * len(graph)
      dq = deque()
      dq.append((0, 0))
      while dq:
        inode, color = dq.popleft()
        visited[inode] = True
        for ichild in graph[inode]:
          if colors[ichild] == -1:
            colors[ichild] = abs(color-1)
          else:
            if colors[ichild] != abs(color-1):
              return False
        if not visited[ichild]:
          dq.append((ichild, abs(color-1)))
      return True
    return bfs()
  
  def wf(edges):
    dp = edges
    for k in range(len(graph)):
      for i in range(len(graph)):
        for j in range(len(graph)):
          dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])
    return dp
  
  edges = [[n+1] * n for _ in range(n)]  
  for i in range(n):
    for j, c in enumerate(input().strip()):
      if c == '1':
        graph[i].append(j)
        edges[i][j] = 1
    edges[i][i] = 0
    
  if not is_bt():
    print(-1)
    return
  print(max([max(x) for x in wf(edges)]) + 1)
  
if __name__=='__main__':
  main()



### FIXED CODE ###

#!/usr/bin/python3
# -*- coding:utf-8 -*-

from collections import defaultdict
from queue import deque

def main():
  n = int(input())
  graph = defaultdict(list)
  
  def is_bt():
    def bfs():
      colors = [-1] * len(graph)
      dq = deque()
      dq.append(0)
      colors[0] = 0
      while dq:
        inode = dq.popleft()
        for ichild in graph[inode]:
          if colors[ichild] == -1:
            colors[ichild] = abs(colors[inode]-1)
            dq.append(ichild)
          else:
            if colors[ichild] == colors[inode]:
              return False
      return True
    return bfs()
  
  def wf(edges):
    dp = edges
    for k in range(len(graph)):
      for i in range(len(graph)):
        for j in range(len(graph)):
          dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j])
    return dp
  
  edges = [[n+1] * n for _ in range(n)]  
  for i in range(n):
    for j, c in enumerate(input().strip()):
      if c == '1':
        graph[i].append(j)
        edges[i][j] = 1
    edges[i][i] = 0
  graph = dict(graph)
    
  if not is_bt():
    print(-1)
    return
  print(max([max(x) for x in wf(edges)]) + 1)
  
if __name__=='__main__':
  main()
### BUGGY CODE ###

import numpy as np
N = int(input())
P_lis = np.array(list(map(int,input().split())))
 
count = 0
for i in range(N):
  for j in range(i):
    if P_lis[i] >= P_lis[j]:
      count += 1
      break
print(N - count)

### FIXED CODE ###

N = int(input())
P_lis = list(map(int, input().split()))
 
dummy = 2*10**5
answer = 0
 
for p in P_lis:
  if p <= dummy:
    answer += 1
    dummy = p
print(answer)