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

n = int(input())
s = [int(x) for x in input().split()]
q = int(input())
t = [int(x) for x in input().split()]
cnt = 0
for i in t:
    if i in s:
        cnt += 1
print(cnt)


### FIXED CODE ###

def binarySearch(array, key):
    left = 0
    right = len(array)
    while left < right:
        mid = int((left + right) / 2)
        if key == array[mid]:
            return True
        elif key > array[mid]:
            left = mid + 1
        elif key < array[mid]:
            right = mid
        else:
            print("ERROR")
    return False


n = int(input())
s = [int(x) for x in input().split()]
q = int(input())
t = [int(x) for x in input().split()]
a = [x for x in t if binarySearch(s, x)]
print(len(a))
### BUGGY CODE ###

from math import gcd

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

def createPrimeList(N, isTable=True):
    isPrime = [True] * (N + 1)
    isPrime[0] = False
    isPrime[1] = False
    for i in range(2, N + 1):
        if not isPrime[i]:
            continue
        for p in range(i * 2, N, i):
            isPrime[p] = False
    return isPrime if isTable else [i for i in range(2, N) if isPrime[i]]

from collections import Counter
primeList = createPrimeList(10**5, False)
def primeFactorization2(N):
    primes = Counter()
    for p in primeList:
        while N % p == 0:
            N //= p
            primes[p] += 1
    return primes

def isSetwise(A):
    ret = A[0]
    for a in A:
        ret = gcd(ret, a)
    return ret == 1

def isPairwise(A):
    P = set()
    for a in A:
        ps = primeFactorization2(a)
        for p in ps.keys():
            if p in P:
                return False
            P.add(p)
    return True

if not isSetwise(A):
    print('not coprime')
    exit()

if isPairwise(A):
    print('pairwise coprime')
else:
    print('setwise coprime')


### FIXED CODE ###

from math import gcd

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

def isSetwise(A):
    ret = A[0]
    for a in A:
        ret = gcd(ret, a)
    return ret == 1
from collections import Counter

def createPrimeList(N):
    isPrime = [True] * (N + 1)
    isPrime[0] = False
    isPrime[1] = False
    smallestPrime = [1] * (N + 1)
    for i in range(2, N + 1):
        if not isPrime[i]:
            continue
        for p in range(i * 2, N, i):
            if isPrime[p]:
                smallestPrime[p] = i
            isPrime[p] = False
    return smallestPrime

from collections import Counter
smallestPrime = createPrimeList(max(A) + 10)
def primeFactorization(N):
    ret = Counter()
    while N > 1:
        p = smallestPrime[N]
        if p == 1:
            ret[N] += 1
            break
        ret[p] += 1
        N //= p
    return ret

def isPairwise(A):
    P = Counter()
    for a in A:
        for p in primeFactorization(a):
            if P[p] >= 1:
                return False
            P[p] += 1
    return True

if not isSetwise(A):
    print('not coprime')
    exit()

if isPairwise(A):
    print('pairwise coprime')
else:
    print('setwise coprime')
### BUGGY CODE ###

import numpy as np

h, w, k = map(int, input().split())
s = []
for _ in range(h):
    s.append(input())

sum = np.array([[0] * (w+1) for _ in range(h+1)], dtype=int)
for i in range(h):
    for j in range(w):
        sum[i+1][j+1] = sum[i][j+1] + sum[i+1][j] - sum[i][j] + (1 if s[i][j] == '1' else 0)

ans = h + w - 2
for ptn in range(1<<h-1):
    cand = 0

    sep = [0]
    for i in range(h-1):
        if((ptn >> i) & 1):
            sep.append(i+1)
            cand += 1
    sep.append(h)
    sep = np.array(sep, dtype=int)

    left = 0
    cur = np.array([0] * (len(sep) - 1), dtype=int)
    for pos in range(w):
        for i in range(len(sep)-1):
            cur[i] = sum[sep[i+1]][pos+1] - sum[sep[i+1]][left] - sum[sep[i]][pos+1] + sum[sep[i]][left]
        if max(cur) > k:
            if left == pos:
                cand = h * w
                break
            else:
                cand += 1
                left = pos
    ans = cand if cand < ans else ans

print(ans)


### FIXED CODE ###

h, w, k = map(int, input().split())
s = []
for _ in range(h):
    s.append(input())

sum = [[0] * (w+1) for _ in range(h+1)]
for i in range(h):
    for j in range(w):
        sum[i+1][j+1] = sum[i][j+1] + sum[i+1][j] - sum[i][j] + (1 if s[i][j] == '1' else 0)

ans = h + w - 2
for ptn in range(1<<h-1):
    cand = 0

    sep = [0]
    for i in range(h-1):
        if((ptn >> i) & 1):
            sep.append(i+1)
            cand += 1
    sep.append(h)

    left = 0
    for pos in range(w):
        cur = []
        for i in range(len(sep)-1):
            cur.append(sum[sep[i+1]][pos+1] - sum[sep[i+1]][left] - sum[sep[i]][pos+1] + sum[sep[i]][left])
        if max(cur) > k:
            if left == pos:
                cand = h * w
                break
            else:
                cand += 1
                left = pos
    ans = cand if cand < ans else ans

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

a,b,k = map(int,input().split())
ans = [i for i in range(a,b+1) if i in range(a,a+k) or i in range(b-k+1,b+1)]
for i in range(len(ans)):
    print(ans[i])

### FIXED CODE ###

a,b,k = map(int,input().split())
if b-a <= 2 * k - 1:
    for i in range(a,b+1):
        print(i)
else:
    for i in range(a,a+k):
        print(i)
    for i in range(b-k+1,b+1):
        print(i)
### BUGGY CODE ###

s = input()
n = len(s)

num = [0]*2019
num[0] = 1

for i in range(n):
    number = int(s[i:])
    num[number%2019] += 1

ans = 0

for i in num:
    ans += i*(i-1)//2

print(ans)

### FIXED CODE ###

s=input()
s=s[::-1]
n=len(s)

count=[0]*2019
count[0]=1
num,d=0,1

for i in s:
  num+=int(i)*d
  num%=2019
  d*=10
  d%=2019
  count[num]+=1

ans=0
for i in count:
  ans+=i*(i-1)//2
  
print(ans)
### BUGGY CODE ###

n = int(input())
a = sorted(map(int, input().split()))
l = [0]*(10**6+1)

for i in a:
  if l[i] == 0:
    l[i] = 1
    for j in range(i*2, max(a)+1, i):
      l[j] = -1
  else:
    l[i] = -1
print(l.count(1))

### FIXED CODE ###

n = int(input())
a = sorted(map(int, input().split()))
l = [0]*(10**6+1)
M = max(a)

for i in a:
  if l[i] == 0:
    l[i] = 1
    for j in range(i*2, M+1, i):
      l[j] = -1
  else:
    l[i] = -1
print(l.count(1))
### BUGGY CODE ###

from itertools import permutations
import sys

N, M, R = map(int, sys.stdin.readline().split())
r = [int(i) - 1 for i in sys.stdin.readline().split()]
d = [[float('inf')] * N for j in range(N)]
for i in range(M):
    A, B, C = map(int, sys.stdin.readline().split())
    d[A-1][B-1] = min(d[A-1][B-1], C)
    d[B-1][A-1] = min(d[B-1][A-1], C)
for k in range(N):
    for s in range(N):
        for e in range(N):
            d[s][e] = min(d[s][e], d[s][k] + d[k][e])
l = float('inf')
for o in permutations(r):
    tmp_l = 0
    for s, e in zip(o[:-1], o[1:]):
        tmp_l = tmp_l + d[s][e]
    l = min(l, tmp_l)
print(l)

### FIXED CODE ###

from itertools import permutations
N, M, R = map(int, input().split())
r = [int(i) - 1 for i in input().split()]
d = [[10000000 for i in range(N)] for j in range(N)]
for i in range(M):
    A, B, C = map(int, input().split())
    d[A-1][B-1] = min(d[A-1][B-1], C)
    d[B-1][A-1] = min(d[A-1][B-1], C)
for k in range(N):
    for s in range(N):
        for e in range(N):
            d[s][e] = min(d[s][e], d[s][k] + d[k][e])
l = True
for o in permutations(r):
    tmp_l = 0
    for s, e in zip(o[:-1], o[1:]):
        tmp_l = tmp_l + d[s][e]
    if l is True:
        l = tmp_l
    else:
        l = min(l, tmp_l)
print(l)
### BUGGY CODE ###

R, G, B, N = map(int, input().split())

ans = [0]*9000000
for r in range(N//R + 1):
    for g in range(N//G + 1):
        for b in range(N//B + 1):
            k = r*R + g*G + b*B
            ans[k] += 1

print(ans[N])

### FIXED CODE ###

R, G, B, N = map(int, input().split())

ans = 0
for r in range(N//R + 1):
    for g in range((N - r*R)//G + 1):
        if (N - r*R - g*G)%B == 0:
                ans += 1
print(ans)
### BUGGY CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
already_town =[1]
now_town=1
check=False
my_append = already_town.append
for i in range(K):
    if(A[now_town-1] in already_town):
        cicle_start_value=A[now_town-1]
        check=True
        break
    my_append(A[now_town-1])
    now_town = A[now_town-1]

if(check==False):
    print(now_town)
else:
    cicle_start=already_town.index(cicle_start_value)
    roop_town=already_town[cicle_start:]
    print(roop_town[(K-cicle_start)%((i+1)-cicle_start)])


### FIXED CODE ###

N,K = map(int,input().split())
A = list(map(int,input().split()))
already_town_check =[False]*(N+1)
already_town_check[1] = True
already_town = [1]
now_town=1
check=False
my_append = already_town.append
for i in range(K):
    check_town=A[now_town-1]
    if(already_town_check[check_town]):
        cicle_start_value=check_town
        check=True
        break
    already_town_check[check_town]=True
    my_append(check_town)
    now_town = check_town

if(check==False):
    print(now_town)
else:
    cicle_start=already_town.index(cicle_start_value)
    roop_town=already_town[cicle_start:]
    print(roop_town[(K-cicle_start)%((i+1)-cicle_start)])
### BUGGY CODE ###

h,w=map(int,input().split())
s=[list(input()) for i in range(h)]
u=[[0]*w for i in range(h)]
d=[[0]*w for i in range(h)]
l=[[0]*w for i in range(h)]
r=[[0]*w for i in range(h)]
for i in range(w):
  if s[0][i]=='.':
    u[0][i]=1
  for j in range(1,h):
    if s[j][i]=='.':
      u[j][i]+=u[j-1][i]+1
for i in range(w):
  if s[h-1][i]=='.':
    d[h-1][i]=1
  for j in range(h-2,-1,-1):
    if s[j][i]=='.':
      d[j][i]+=d[j+1][i]+1
for i in range(h):
  if s[i][0]=='.':
    l[i][0]=1
  for j in range(1,w):
    if s[i][j]=='.':
      l[i][j]+=l[i][j-1]+1
for i in range(h):
  if s[i][w-1]=='.':
    r[i][w-1]=1
  for j in range(w-2,-1,-1):
    if s[i][j]=='.':
      r[i][j]+=r[i][j+1]+1
ans=0
for i in range(h):
  for j in range(w):
    if s[i][j]=='.':
      ans=max(ans,u[i][j]+d[i][j]+l[i][j]+r[i][j]-3)
print(ans)


### FIXED CODE ###

import sys
input=sys.stdin.readline
h,w=map(int,input().split())
s=[list(input()) for i in range(h)]
u=[[0]*w for i in range(h)]
d=[[0]*w for i in range(h)]
l=[[0]*w for i in range(h)]
r=[[0]*w for i in range(h)]
for i in range(h):
  for j in range(w):
    if s[i][j]=='#':
      d[i][j]=0
      l[i][j]=0
    else:
      if i!=0:
        d[i][j]+=d[i-1][j]+1
      else:
        d[i][j]=1
      if j!=0:
        l[i][j]+=l[i][j-1]+1
      else:
        l[i][j]=1
for i in range(h)[::-1]:
  for j in range(w)[::-1]:
    if s[i][j]=='#':
      r[i][j]=0
      u[i][j]=0
    else:
      if i!=h-1:
        u[i][j]+=u[i+1][j]+1
      else:
        u[i][j]=1
      if j!=w-1:
        r[i][j]+=r[i][j+1]+1
      else:
        r[i][j]=1
ans=0
for i in range(h):
  for j in range(w):
    if s[i][j]=='.':
      ans=max(ans,u[i][j]+d[i][j]+l[i][j]+r[i][j]-3)
print(ans)
### BUGGY CODE ###

n = int(input())
a = [int(i) for i in input().split()]

b = set(a)
c = []
for i in b:
  c.append([i, a.count(i)])

t = []
for j in range(len(c)):
  total = 0
  total += c[j][1]
  
  if c[j][0]-1 in b:
    total += c[j-1][1]
  
  if c[j][0]+1 in b:
    total += c[j+1][1]

  t.append(total)

print(max(t))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = [0] * (int(1e5)+5)
for i in range(n):
    ans[a[i]-1] += 1
    ans[a[i]] += 1
    ans[a[i]+1] += 1
print(max(ans))
### BUGGY CODE ###




aa=int(input())
N=[0 for i in range(aa)]
for i in range(aa):
  bb=input()
  #print(b)
  N[i]=bb.split()




def aaa(n):

  a=int(N[n][0])
  b=int(N[n][1])
  c=int(N[n][2])
  d=int(N[n][3])

  e=a-a//b*b
  f=d-d//b*b
  




  if a<b or d<b :
    return "No"
  
  elif b<=c :
    return "Yes"
  else:
  
    if f!=0 :
      
      
      for j in range(b//f):
        if e>c :
          return "No"
          
        e=(e+f)%b

        #print(e)
        #print(f)
  #print("while")
    else:
      if e>c :
        return "No"

  return "Yes"

for i in range(aa):
  print(aaa(i))


### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
C = [list(map(int,input().split())) for i in range(n)]

from fractions import gcd

for i in range(n):
    a = C[i][0]
    b = C[i][1]
    c = C[i][2]
    d = C[i][3]
    ng = 0

    e = 0  # 最初に補充が発生する直前の本数
    e0 = a - b
    e1 = ((c - a%b) // b) * b + a%b
    e = min(e0, e1)

    if e < 0 or b > d:
        ng = 1
    else:
        g = gcd(b, d)
        # print(c+1, b-1, g)
        if c+1 <= b-1 and (c - e) // g < (b-1 - e) // g:
            ng = 1

    if ng == 1:
        print("No")
    else:
        print("Yes")
### BUGGY CODE ###

from collections import deque

N, M = map(int, input().split())
graph = [set() for _ in range(N+1)]
for i in range(M):
    a, b = map(int, input().split())
    graph[a].add(b)
    graph[b].add(a)

def bfs(graph):
    visited = set()
    queue = deque()
    queue.append(1)
    ans = [0] * (N+1)
    while queue:
        cur = queue.popleft()
        visited.add(cur)
        for n in graph[cur]:
            if n not in visited and n not in queue:
                ans[n] = cur
                queue.append(n)
    return ans

ans = bfs(graph)
print("Yes")
for i in range(2, len(ans)):
    print(ans[i])

### FIXED CODE ###

import sys
from collections import deque
 
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
 
N, M = lr()
graph = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = lr()
    graph[a].append(b)
    graph[b].append(a)
 
def bfs():
    que = deque([1])
    dir = [None] * (N+1)    
    while que:
        cur = que.popleft()
        for n in graph[cur]:
            if dir[n] != None:
                continue
            dir[n] = str(cur)
            que.append(n)
    return dir
 
dir = bfs()
print('Yes')
print('\n'.join(dir[2:]))
### BUGGY CODE ###

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

from collections import deque

H, W = map(int,input().split())
sth, stw = map(int,input().split())
glh, glw = map(int,input().split())
sth, stw = sth-1, stw-1
glh, glw = glh-1, glw-1

INF = -1
Gmap = [list(input()) for _ in range(H)]
seen = [[INF]*W for _ in range(H)]
direc = {(1,0), (-1,0), (0,1), (0,-1)}
direc5 = set([])
for i in range(-2,3):
    for j in range(-2,3):
        direc5.add((i, j))
direc5 = direc5 - direc
direc5 = direc5 - {(0,0)}
nxt_st = set([])
nxt_st_all = set([])

def bfs(pnxt):
    next_q = deque([])
    for hw in pnxt:
        next_q.append(hw)
    nxt = set([])
    while len(next_q)!=0:
        #キュー取り出し(先頭)
        h,w = next_q.popleft()
        if h == glh and w == glw:
            print(ret)
            exit()
        seen[h][w] = 0
        for dh, dw in direc:
            hs, ws = h + dh, w + dw
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.' and seen[hs][ws]==INF and not (hs, ws) in nxt_st_all:
                next_q.append((hs, ws))
        for dh, dw in direc5:
            hs, ws = h + dh, w + dw
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.' and seen[hs][ws]==INF and not (hs, ws) in nxt_st_all | nxt:
                nxt.add((hs, ws))

    return nxt

ret = -1
nxt_st.add((sth, stw))
while len(nxt_st)>0:
    nxt_st_all = nxt_st_all | nxt_st
    ret += 1
    nxt_st = bfs(nxt_st)
print(-1)


### FIXED CODE ###

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

from collections import deque

H, W = map(int,input().split())
sth, stw = map(int,input().split())
glh, glw = map(int,input().split())
sth, stw = sth-1, stw-1
glh, glw = glh-1, glw-1

INF = -1
Gmap = [list(input()) for _ in range(H)]
seen = [[INF]*W for _ in range(H)]
direc = {(1,0), (-1,0), (0,1), (0,-1)}
direc5 = set([])
for i in range(-2,3):
    for j in range(-2,3):
        direc5.add((i, j))
direc5 = direc5 - direc
direc5 = direc5 - {(0,0)}

def bfs(pnxt):
    next_q = deque([])
    for h, w in pnxt:
        next_q.append((h,w))
        seen[h][w] = 0
    nxt = set([])
    while len(next_q)!=0:
        h, w = next_q.popleft()
        if h == glh and w == glw:
            print(ret)
            exit()
        for dh, dw in direc:
            hs, ws = h + dh, w + dw
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.' and seen[hs][ws]==INF:
                next_q.append((hs, ws))
                seen[hs][ws] = 0
        for dh, dw in direc5:
            hs, ws = h + dh, w + dw
            if not (0<=hs<H and 0<=ws<W):
                continue
            if Gmap[hs][ws]=='.' and seen[hs][ws]==INF and not (hs, ws) in nxt:
                nxt.add((hs, ws))
    return nxt

ret = 0
nxt_st = set([])
nxt_st.add((sth, stw))
while len(nxt_st)>0:
    nxt_st = bfs(nxt_st)
    ret += 1
print(-1)
### BUGGY CODE ###

N = int(input())
P = list(map(int, input().split()))
cnt = 0
for n in range(N):
    res = True
    for i in range(n):
        if P[n] > P[i]:
            res = False
            break
    if res:
        cnt += 1
print(cnt)

### FIXED CODE ###

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

N = int(input())
A = list(map(int, input().split()))
B = [0]*(N+1)
S = 0

for i in range(1, N+1):
    B[i] = A.count(i)
    S += int(B[i]*(B[i]-1)/2)

for i in range(N):
    print(S-B[A[i]]+1)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = [0]*(N+1)
S = 0

for i in range(N):
    B[A[i]] += 1

for i in range(1, N+1):
    S += B[i]*(B[i]-1)//2

for k in range(N):
    print(S-B[A[k]]+1)
### BUGGY CODE ###

h,w,k=map(int,input().split())

y1,x1,y2,x2=map(int,input().split())

maze=[list(input()) for _ in range(h)]

from collections import deque
stack=deque([(y1-1,x1-1)])

def pri(x):
    print("MAZE###########")
    for item in x:
        print(item)

maze[y1-1][x1-1]=0
#pri(maze)
while len(stack)>0:
    #print(stack)
    (y,x)=stack.popleft()
    if (y,x)==(y2-1,x2-1):
        print(maze[y][x])
        exit()

    #縦横左右
    for (my,mx) in [(1,0),(0,1),(-1,0),(0,-1)]:
        #print(my,mx)
        flag=0
        for kk in range(1,k+1):
            ny=y+my*kk
            nx=x+mx*kk
            if 0<=ny<h and 0<=nx<w:
                if maze[ny][nx]!="@":
                    if maze[ny][nx]=="." and flag==0:
                        maze[ny][nx]=maze[y][x]+1
                        stack.append((ny,nx))
                else:
                    flag=1
                    break
            else:
                break
    #pri(maze)
print(-1)


### FIXED CODE ###

def main():
    import sys
    from collections import deque
    input=sys.stdin.readline

    h,w,k=map(int,input().split())
    sy,sx,gy,gx=map(int,input().split())

    #maze=[]
    #for _ in range(h):
    #    maze.append(tuple(input()))

    maze=[tuple(input()) for _ in range(h)]

    sy-=1
    sx-=1
    gy-=1
    gx-=1

    #maze[sy][sx]="S"

    dis=[[-1]*w for _ in range(h)]



    dis[sy][sx]=0



    d = deque([(sx,sy)])
    while len(d)>0:
        (x,y)=d.popleft()
        if x==gx and y==gy:
            print(dis[gy][gx])
            #maze[gy][gx]="G"

            #pri(dis)
            #pri(maze)

            exit()

        for (mx,my) in ((0,1),(1,0),(-1,0),(0,-1)):
            #print(mx,my,d)
            for j in range(1,k+1):
                nx=x+mx*j
                ny=y+my*j
                #print(y,x,">>",ny,nx)
                if 0<=nx<w and 0<=ny<h:
                    if maze[ny][nx]=="." and (dis[ny][nx]==-1 or dis[ny][nx]==dis[y][x]+1):
                        if dis[ny][nx]==-1:
                            d.append((nx,ny))
                        dis[ny][nx]=dis[y][x]+1
                        
                        #pri(dis)
                    else:
                        break
                else:
                    break

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

n,x=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]

sum=0
for i in range(n):
    if(a[i]>x):
        temp=a[i]-x
        a[i]-=temp
        sum+=temp
for i in range(1,n):
    while(x<(a[i]+a[i-1])):
        a[i]-=1
        sum+=1
print(sum)

### FIXED CODE ###

n,x=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]

sum=0
for i in range(n):
    if(a[i]>x):
        temp=a[i]-x
        a[i]-=temp
        sum+=temp
    if(i>0):
        temp=a[i]+a[i-1]
        if(x<temp):
            a[i]-=temp-x
            sum+=temp-x
print(sum)
### BUGGY CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
p = LIST()

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

### FIXED CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
p = LIST()

ans = 0
ma = 0
# for i in range(n):
#     flag = True
#     pi = p[i]
#     if ma > pi:
#         flag = False
#         ma = pi
#     # ma = pi
#     # for j in range(i, -1, -1):
#     #     if pi > p[j]:
#     #         flag = False
#     if flag ==True:
#         ans += 1
# print(ans)
ans = 1
m = p[0]
for i in range(1, n):
    if m > min(m, p[i-1]):
        m = min(m, p[i-1])
        # print(m)
    if m >=  p[i]:
        ans += 1
    # m = p[0:i]
    # print(m)

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

from collections import deque

N, M = map(int, input().split())
A = []
B = []
route = [[False for _ in range(N)] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    route[a-1][b-1] = True
    route[b-1][a-1] = True

print('Yes')

q = deque()
d = [-1] * N
d[0] = 0
for i in range(1, N):
    if route[0][i]:
        q.append(i)
        d[i] = 1

while len(q) != 0:
    x = q.popleft()
    for i in range(1, N):
        if route[x][i] and d[i] == -1:
            d[i] = x + 1
            q.append(i)

for i in range(1, N):
    print(d[i])


### FIXED CODE ###

from collections import deque

N, M = map(int, input().split())

route = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    route[a - 1].append(b - 1)
    route[b - 1].append(a - 1)

print('Yes')

q = deque()
d = [-1] * N
d[0] = 0
q.append(0)

while q:
    x = q.popleft()
    for i in route[x]:
        if d[i] == -1:
            d[i] = x + 1
            q.append(i)

for i in range(1, N):
    print(d[i])
### BUGGY CODE ###

r, g, b, n = map(int, input().split())
cnt = 0
for red in range(n // r + 1):
    for green in range(n // g + 1):
        blue = n - red * r - green * g
        if blue >= 0 and blue % b == 0:
            cnt += 1
print(cnt)

### FIXED CODE ###

r, g, b, n = map(int, input().split())
cnt = 0
for red in range(n // r + 1):
    for green in range((n - r * red) // g + 1):
        blue = n - red * r - green * g
        if blue >= 0 and blue % b == 0:
            cnt += 1
print(cnt)