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

n,m = map(int, input().split())
if m == 0:
  print(1)
elif m == 1:
  print(2)
else:
  ls=[]
  a,b = map(int, input().split())
  tmp = {a, b}
  ls.append(tmp)
  for i in range(m-1):
    a,b = map(int, input().split())
    for s in ls:
      if (a in s) or (b in s):
        s.add(a)
        s.add(b)
        break
      else:
        tmp = {a,b}
        ls.append(tmp)

  ans = 0
  for s in ls:
    ans = max(ans, len(s))
  print(ans)

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())
      
n,m = map(int, input().split())
uf = UnionFind(n)
for i in range(m):
  a,b = map(int, input().split())
  uf.union(a-1, b-1)

ans = 0
for i in uf.roots():
  ans = max(ans, uf.size(i))
print(ans)
### BUGGY CODE ###

N = int(input())
arr = sorted(list(map(int, input().split())))
ans_list = []
chohuku = [x for x in set(arr) if arr.count(x) > 1]
count_arr = [0]*arr[-1]

ans = 0
for i in arr:
    if count_arr[i-1] == 0:
        ans += 1
        ans_list.append(i)
    for j in range(1,(arr[-1]//i)+1):
        count_arr[(i*j)-1] += 1

for i in ans_list:
    if i in chohuku:
        ans -= 1

print(ans)

### FIXED CODE ###

N = int(input())
arr = sorted(list(map(int, input().split())))
count_arr = [0]*arr[-1]

ans = 0
for i in arr:
    for j in range(1,(arr[-1]//i)+1):
        count_arr[(i*j)-1] += 1
for i in arr:
    if count_arr[i-1] == 1:
        ans +=1

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

n = int(input())
s = {}
for i in range(n):
  x = input()
  if x not in s.keys():
    s[x] = 1
  else:
    s[x] += 1
x = max(list(s.values()))
keys = sorted([k for k, v in s.items() if v == x])
for i in keys:
  print(i)

### FIXED CODE ###

n = int(input())
s = {}
for i in range(n):
  x = input()
  if x not in s.keys():
    s[x] = 1
  else:
    s[x] += 1
x = max(list(s.values()))
keys = sorted([k for k, v in s.items() if v == x])
for i in keys:
  print(i)
### BUGGY CODE ###

def check(ary, div):
    c = 0
    for i in range(len(ary)):
        if ary[i] % div == 0:
            c += 1
    if c >= len(ary) - 1:
        return True
    else:
        return False
 
N = int(input())
data = list(map(int, input().split()))
ans = 1
for i in range(1, max(data) + 1)[::-1]:
    if check(data, i):
        ans = i
        break
 
print(ans)


### FIXED CODE ###

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

def gcd(a, b):
    while b:
        a, b = b, a % b
        # print("a b", a, b)
    return a

left_ = [0] * (n + 1)
right_ = [0] * (n + 1)
ans = []

for i in range(n):
    left_[i] = gcd( left_[i-1], data[i] )

for i in range(n-1, 0, -1):
    right_[i] = gcd( right_[i+1], data[i] )

for i in range(n):
    ans += [ gcd( left_[i-1], right_[i+1] ) ]

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

N=input()
List=list(N)
M=len(List)
ans=0
Mods=[0]*(M+1)
Mods[M]=0
Sum=""
for i in range(M):
  Sum=List[M-i-1]+Sum
  Mods[M-i-1]=int(Sum)%2019
Mods.sort()

import collections
C=collections.Counter(Mods)
for j in range((Mods[M])):
  if C[j]!=1:
    k=C[j]
    ans+=k*(k-1)/2
print(int(ans))

### FIXED CODE ###

S = input()[::-1]

#aのMOD求めるンゴ
MOD=2019
ls_rem_a=[]
d=1
for i in range(len(S)):
  ls_rem_a.append(int(S[i])*d%MOD)
  d = d*10%MOD

#次に累積和求めるンゴ
ls_rem_s=[0]
sum=0
for i in range(len(S)):
  sum+=ls_rem_a[i]
  sum%=MOD
  ls_rem_s.append(sum)

#最後にMODが同じやつの個数を調べるンゴ
from collections import Counter
C_rem = Counter(ls_rem_s)
ans=0
for i in C_rem.keys():
  n=C_rem[i]
  ans+=n*(n-1)//2
print(ans)
### BUGGY CODE ###

N, M = [int(i) for i in input().split()]
corrects = []
wrongs = [0 for _ in range(N)]
for m in range(M):
  p, s = input().split()
  p = int(p)
  if p not in corrects:
    if s == "WA":
      wrongs[p-1] += 1
    elif s == "AC":
      corrects.append(p)
  
total_wrongs = 0
for p in corrects:
  total_wrongs += wrongs[p-1]
      
print(len(corrects), total_wrongs)

### FIXED CODE ###

N, M = [int(i) for i in input().split()]
corrects = [0 for _ in range(N)]
wrongs = [0 for _ in range(N)]
for m in range(M):
  p, s = input().split()
  p = int(p)
  if corrects[p-1] == 0:
    if s == "WA":
      wrongs[p-1] += 1
    elif s == "AC":
      corrects[p-1] = 1
      corrects.append(p)
  
total_wrongs = 0
total_correct = 0
for i in range(N):
  if corrects[i] > 0:
      total_wrongs += wrongs[i]
      total_correct += 1
  
print(total_correct, total_wrongs)
### BUGGY CODE ###

def solve():
    r1, c1, r2, c2 = map(int, input().split())

    MOD = 10**9+7
    n = r2+c2+1
    fac = [1]*(n+1)
    rev = [1]*(n+1)
    
    for i in range(1,n+1):
      fac[i] = i*fac[i-1]%MOD
      rev[i] = pow(fac[i], MOD-2, MOD)
    
    comb = lambda a,b:(fac[a]*rev[a-b]*rev[b])%MOD

    def f(r, c):
        ans = 0
        for i in range(1, c+2):
            ans += comb(r+i, i)
            ans %= MOD
        return ans

    ans = f(r2, c2) - f(r2, c1-1) - f(r1-1, c2) + f(r1-1, c1-1)
    ans %= MOD

    print(ans)


if __name__ == "__main__":
    solve()


### FIXED CODE ###

def solve():
    r1, c1, r2, c2 = map(int, input().split())

    MOD = 10**9+7
    n = r2+c2+2
    fac = [1]*(n+1)
    rev = [1]*(n+1)
    
    for i in range(1,n+1):
      fac[i] = i*fac[i-1]%MOD
      rev[i] = pow(fac[i], MOD-2, MOD)
    
    comb = lambda a,b:(fac[a]*rev[a-b]*rev[b])%MOD

    def f(r, c):
        return comb(r+c+2, c+1)

    ans = f(r2, c2) - f(r2, c1-1) - f(r1-1, c2) + f(r1-1, c1-1)
    ans %= MOD

    print(ans)


if __name__ == "__main__":
    solve()
### BUGGY CODE ###

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math

    #inf = 10**17
    mod = 10**9 + 7

    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a % b)
    
    def gcd_group(arr):
        g = gcd(arr[0], arr[1])
        for i in range(2, len(arr)):
            g = gcd(g, arr[i])
        return g
    
    def lcm(a, b):
        g = gcd(a, b)
        return (a*b)//g
    
    def lcm_group(arr):
        l = lcm(arr[0], arr[1])
        for i in range(2, len(arr)):
            l = lcm(l, arr[i])
        return l
    
    # groupは要素1つでエラー

    n = int(input())
    a = list(map(int, input().split()))
    if n == 1:
        print(1)
    else:
        l = lcm_group(a)
        res = 0
        for i in a:
            res += (l // i) % mod
        print(res%mod)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math

    #inf = 10**17
    mod = 10**9 + 7

    def gcd(a, b):
        if b == 0:
            return a
        else:
            return gcd(b, a % b)
    
    def gcd_group(arr):
        g = gcd(arr[0], arr[1])
        for i in range(2, len(arr)):
            g = gcd(g, arr[i])
        return g
    
    def lcm(a, b):
        g = gcd(a, b)
        return (a*b)//g
    
    def lcm_group(arr):
        l = lcm(arr[0], arr[1])
        for i in range(2, len(arr)):
            l = lcm(l, arr[i])
        return l
    
    # groupは要素1つでエラー

    # aの逆元を求める
    def inv(a, mod=mod):
        return pow(a, mod-2, mod)

    n = int(input())
    a = list(map(int, input().split()))
    if n == 1:
        print(1)
    else:
        l = lcm_group(a)
        res = 0
        for i in a:
            res += inv(i)
        print(res*l%mod)

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

import numpy as np
N, K = map(int, input().split())
A = list(map(int, input().split()))
foo = np.ones((42, N), dtype = "int64")
for k in range(len(A)):
    foo[0][k] = A[k]
if K <42:
    for q in range(K):
        unko = np.zeros(N, dtype = "int64")
        for k in range(N):
            if k + foo[q][k]+1 < N:
                unko[k + foo[q][k]+1] -=1
            unko[max(k - foo[q][k], 0)] +=1
        unchi = 0
        for k in range(N):
            unchi += unko[k]
            foo[q+1][k] = unchi
        #print(unko)
        #print(foo[q+1])
        count =0
        for l in range(N):
            if foo[q+1][l] < N:
                break
            else:
                count +=1
        
        if count == N:
            break
        
                        
        #print(foo)
    print(" ".join(map(str, foo[q+1])))

     
else:
    print((str(N)+" ")*(N-1)+str(N))




### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
foo = [[0 for k in range(N)] for k in range(42)]
for k in range(len(A)):
    foo[0][k] = A[k]
if K <42:
    for q in range(K):
        unko = [0 for k in range(N)]
        for k in range(N):
            if k + foo[q][k]+1 < N:
                unko[k + foo[q][k]+1] -=1
            unko[max(k - foo[q][k], 0)] +=1
        unchi = 0
        for k in range(N):
            unchi += unko[k]
            foo[q+1][k] = unchi
        #print(unko)
        #print(foo[q+1])
        count =0
        for l in range(N):
            if foo[q+1][l] < N:
                break
            else:
                count +=1
        
        if count == N:
            break
        
                        
        #print(foo)
    print(" ".join(map(str, foo[q+1])))

     
else:
    print((str(N)+" ")*(N-1)+str(N))
### BUGGY CODE ###

n = int(input())
list = [int(x+1) for x in range(n)]
list.pop(0)
list.append(1)
mod = 0

for i in range(n) :
    mod += (i + 1) % list[i]
print(mod)

### FIXED CODE ###

n = int(input())
print((n*(n-1))//2)
### BUGGY CODE ###

import sys
from collections import deque

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N = ri()
A = [deque(rl()[::-1]) for _ in range(N)]
answer = 0
match = 0
while True:
    used = set()
    bool = False
    for i in range(N):
        if len(A[i]) == 0:
            continue
        op = A[i][-1] - 1
        if op in used or i in used:
            continue
        if A[op][-1]-1 == i:
            used.add(i)
            used.add(op)
            match += 1
            bool = True
            A[i].pop()
            A[op].pop()
    
    answer += 1
    if match == N * (N-1) // 2:
        break
    if not bool:
        print(-1)
        exit()

print(answer)


### FIXED CODE ###

import sys
import copy
from collections import deque

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = [deque(lr()) for _ in range(N)]

match = 0
candidate = []
used = set()
for i in range(N):    
    bool = False
    if len(A[i]) == 0:
        continue
    op = A[i][0] - 1
    if op in used or i in used:
        continue
    if A[op][0]-1 == i:
        used.add(i)
        used.add(op)
        candidate.extend([i, op])
        match += 1
        bool = True
        A[i].popleft()
        A[op].popleft()
answer = 1

while True:
    used = set()
    bool = False
    c = []
    for i in candidate:
        if len(A[i]) == 0:
            continue
        op = A[i][0] - 1
        if op in used or i in used:
            continue
        if A[op][0]-1 == i:
            used.add(i)
            used.add(op)
            match += 1
            c.extend([i, op])
            bool = True
            A[i].popleft()
            A[op].popleft()
    
    answer += 1
    candidate = c
    if match == N * (N-1) // 2:
        break
    if not bool:
        print(-1)
        exit()

print(answer)
### BUGGY CODE ###


N = int(input())


power = 1


for i in range(1, N + 1):
    power *= i


power %= 10 ** 9 + 7

print(power)


### FIXED CODE ###

# N回だけトレーニングする
import numpy as np
N = int(input())

# パワー
power = 1

# i回目のトレーニングを終えるとパワーが
# i倍されます。
# 答えの値は非常に大きな値になることがあるので
# 10**9+7で割ったあまりを出力

for i in range(1, N + 1):
    power = np.mod(i * power, 10 ** 9 + 7)
print(power)
### BUGGY CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math

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

# def findsame(aa):
#     s = 0
#     for a in aa:
#         s += (len([x for x in aa if x == a]) - 1)
#     return int(s / 2)

# for k in range(len(aa) - 1):
#     print(findsame(aa[:k] + aa[k+1:]))
# print(findsame(aa[:len(aa)-1]))

aaa = dict()
for a in aa:
    if a not in aaa:
        aaa[a] = len([x for x in aa if x == a])

sum = 0
for k in aaa:
    sum += int(aaa[k] * (aaa[k] - 1) / 2)

for a in aa:
    print(sum - (aaa[a] - 1))


### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import math

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

# def findsame(aa):
#     s = 0
#     for a in aa:
#         s += (len([x for x in aa if x == a]) - 1)
#     return int(s / 2)

# for k in range(len(aa) - 1):
#     print(findsame(aa[:k] + aa[k+1:]))
# print(findsame(aa[:len(aa)-1]))

# aaa = dict()
# for a in aa:
#     if a not in aaa:
#         aaa[a] = len([x for x in aa if x == a])

# sum = 0
# for k in aaa:
#     sum += int(aaa[k] * (aaa[k] - 1) / 2)

# for a in aa:
#     print(sum - (aaa[a] - 1))

aaa = dict()
for a in aa:
    if a not in aaa:
        aaa[a] = 1
    else:
        aaa[a] += 1

sum = 0
for k in aaa:
    sum += int(aaa[k] * (aaa[k] - 1) / 2)

for a in aa:
    print(sum - (aaa[a] - 1))
### BUGGY CODE ###

n, m = list(map(int, input().split()))
a = []
for _ in range(m):
    a.append(int(input()))
cur = 0
dp = [0 for _ in range(n + 1)]
dp[0], dp[1] = 1, 1
if 1 in a:
    dp[1] = 0
for i in range(2, n + 1):
    if i in a:
        continue
    dp[i] = (dp[i - 1] + dp[i - 2]) % (10 ** 9 + 7)
print(dp[n])


### FIXED CODE ###

n, m = list(map(int, input().split()))
a = []
for i in range(m):
    a.append(int(input()))
a = set(a)
dp = [0 for _ in range(n+1)]
dp[0] = 1
if 1 in a:
    dp[1] = 0
else:
    dp[1] = 1
for i in range(2, n+1):
    if not(i in a):
        dp[i] = dp[i - 2] + dp[i - 1]
print(dp[n] % 1000000007)
### BUGGY CODE ###

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

arr=[]
for a in A:
    arr.append(a)
    arr=arr[::-1]

print(' '.join(arr))

### FIXED CODE ###

N=int(input())
arr=input().split()
ans=arr[::2][::-1]+arr[1::2]
if not N&1:
    ans=ans[::-1]
print(*ans,sep=' ')
### BUGGY CODE ###

N, M = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)

for x in range(M):
    A[0] = A[0] // 2
    A = sorted(A, reverse=True)
print(sum(A))


### FIXED CODE ###

import heapq

N, M = map(int, input().split())
A = sorted(list(map(int, input().split())), reverse=True)
A = list(map(lambda x: x * (-1), A))
heapq.heapify(A)

for x in range(M):
    maxA = heapq.heappop(A)
    heapq.heappush(A, -1 * ((-1 * maxA) // 2))
A = list(map(lambda x: x * (-1), A))

print(sum(A))
### BUGGY CODE ###

from operator import mul
from functools import reduce

a = int(input())
l = list(map(int, input().split()))
ans = reduce(mul, l) 
if 10**18 < ans:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

a = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 1
for i in range(a):
  ans = ans * l[i]
  if 10**18 < ans:
    ans = -1
    break

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

N = int(input())

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

cand = []
for i in range(1, N):
    diff = abs(sum(A[:i]) - sum(A[i:]))
    cand.append(diff)
print(min(cand))

### FIXED CODE ###

N = int(input())

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

cand = []
left = 0
right = sum(A)
for i in range(N-1):
    left += A[i]
    right -= A[i]
    diff = abs(left - right)
    cand.append(diff)
print(min(cand))
### BUGGY CODE ###

I=9**9
h,a,*m=open(0)
h,w,k,a,b,f,g=map(int,(h+a).split())
d=[I]*h*w
d[~w+a*w+b]=1
q=[(a-1,b-1)]
for s,t in q:
 p=d[s*w+t]+1
 for y,x in(-1,0),(0,-1),(0,1),(1,0):
  for z in range(k):
   i,j=s+y*~z,t+x*~z
   if(h>i>-1<j<w)-1or'.'<m[i][j]or d[i*w+j]<p:break
   q.append((i,j));d[i*w+j]=p
print(d[~w+f*w+g]%I-1)

### FIXED CODE ###

I=9**9
h,a,*m=open(0)
h,w,k,a,b,f,g=map(int,(h+a).split())
d=[I]*h*w
a=~w+a*w+b
d[a]=1
q=[a]
for s in q:
 for y,x in(1,0),(-1,0),(0,1),(0,-1):
  for z in range(k):
   i,j=s//w+y*~z,s%w+x*~z;t=i*w+j
   if(h>i>-1<j<w)-1or'.'<m[i][j]or d[t]<=d[s]:break
   if d[t]==I:q+=t,;d[t]=d[s]+1
print(d[~w+f*w+g]%I-1)
### BUGGY CODE ###

h,w = (int(x) for x in input().split())
ab = []
count = 0
for _ in range(h):
    a = input()
    a = a+'#'
    ab.append(list(a))
ab.append(list('#'*w))
mx = 0

for i in range(h):
    for j in range(w):
        if ab[i][j] == '.':
            dp = [[0 for a in range(w)] for b in range(h)]
            dp[i][j] = 1
            count = 1 
            step = []

            y, x = i, j
            if ab[y+1][x] == '.' :
                step.append([y+1, x])
                dp[y+1][x] = 1
                count += 1
                while len(step)>0:
                    y1,x1=step.pop()
                    if ab[y1+1][x1] == '.' :
                        step.append([y1+1, x1])
                        dp[y1+1][x1] = 1
                        count += 1 
                        
            if ab[y][x+1] == '.' :
                step.append([y, x+1])
                dp[y][x+1] = 1
                count += 1
                while len(step)>0:
                    y1,x1=step.pop()
                    if ab[y1][x1+1] == '.' :
                        step.append([y1, x1+1])
                        dp[y1][x1+1] = 1
                        count += 1
            if ab[y-1][x] == '.' :
                step.append([y-1, x])
                dp[y-1][x] = 1
                count += 1
                while len(step)>0:
                    y1,x1=step.pop()
                    if ab[y1-1][x1] == '.' :
                        step.append([y1-1, x1])
                        dp[y1-1][x1] = 1
                        count += 1
            if ab[y][x-1] == '.' :
                step.append([y, x-1])
                dp[y][x-1] = 1
                count += 1
                while len(step)>0:
                    y1,x1=step.pop()
                    if ab[y1][x1-1] == '.' :
                        step.append([y1, x1-1])
                        dp[y1][x1-1] = 1
                        count += 1

            mx = max([mx, count])
            #print(mx, i, j)

print(mx)

### FIXED CODE ###

H,W = map(int,input().split())
S = [input() for _ in range(H)]
L,R,D,U = [[[0]*W for _ in range(H)] for i in range(4)]
 
for h in range(H):
    for w in range(W):
        if S[h][w] == '.':
            L[h][w] = L[h][w-1]+1
            U[h][w] = U[h-1][w]+1
        if S[h][W-1-w] == '.':
            R[h][-w-1] = R[h][-w]+1
        if S[H-1-h][w] == '.':
            D[-h-1][w] = D[-h][w]+1
 
ans = 0
for h in range(H):
    for w in range(W):
        if S[h][w] == '.':
            ans = max(ans,L[h][w]+U[h][w]+R[h][w]+D[h][w]-3)
 
print(ans)
### BUGGY CODE ###

from collections import deque

H,W = map(int, input().split())

A = [["" for _ in range(W)] for _ in range(H)]

stack = deque()
for i in range(H):
    tmp = list(input())
    for j in range(W):
        A[i][j] = tmp[j]
        if tmp[j] == "#":
            stack.append((i,j))

ans = 0
flag = False
if stack:
    flag = True
while flag:
    ans += 1
    #print(ans, stack)
    flag = False
    new_stack = deque()
    while stack:
        a,b = stack.pop() # 取り出す
        # A[a][b]の隣接マスについて調べる
        if a != 0: # 上
            if A[a-1][b] == ".": # 白の場合
                A[a-1][b] = "#"
                new_stack.append((a-1,b))
        if a != H-1: # 下
            if A[a+1][b] == ".": # 白の場合
                A[a+1][b] = "#"
                new_stack.append((a+1,b))
        if b != 0: # 左
            if A[a][b-1] == ".": # 白の場合
                A[a][b-1] = "#"
                new_stack.append((a,b-1))
        if b != W-1: # 右
            if A[a][b+1] == ".": # 白の場合
                A[a][b+1] = "#"
                new_stack.append((a,b+1))
    stack = new_stack
    if stack:
        flag = True
    else:
        ans -= 1 

print(ans)
        






### FIXED CODE ###

from collections import deque

def main():
    H,W = map(int, input().split())

    A = [[a for a in input()] for _ in range(H)]
    #stack = deque([(i, j) for i in range(H) for j in range(W) if A[i][j]=="#"])
    stack = [(i, j) for i in range(H) for j in range(W) if A[i][j]=="#"]
    ans = 0
    flag = False
    if stack:
        flag = True
    while flag:
        ans += 1
        flag = False
        #new_stack = deque()
        new_stack = []
        for a,b in stack:
        #while stack:
            #a,b = stack.pop() # 取り出す
            # A[a][b]の隣接マスについて調べる
             # 上
            if a != 0 and A[a-1][b] == ".": # 白の場合
                    A[a-1][b] = "#"
                    new_stack.append((a-1,b))
             # 下
            if a != H-1 and A[a+1][b] == ".": # 白の場合
                    A[a+1][b] = "#"
                    new_stack.append((a+1,b))
            # 左
            if b != 0 and A[a][b-1] == ".": # 白の場合
                    A[a][b-1] = "#"
                    new_stack.append((a,b-1))
            # 右
            if b != W-1 and A[a][b+1] == ".": # 白の場合
                    A[a][b+1] = "#"
                    new_stack.append((a,b+1))
        stack = new_stack
        if stack:
            flag = True
        else:
            ans -= 1 

    print(ans)
            


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

k = int(input())

def gcd(a, b, c):
    min = a
    if b < a:
        min = b
    if c < a:
        min = c
    g = 1
    for i in range(min):
        j = min - i
        if a % j == 0 and b % j == 0 and c % j == 0:
            g = j
            break
    return g

sum = 0
for i in range(1, k+1):
    for j in range(1, k+1):
        for k in range(1, k+1):
            g = gcd(i, j, k)
            sum += g
print(sum)


### FIXED CODE ###

k = int(input())

def gcd(a, b): # a<=b
    if b%a==0:
        return a
    else:
        c = b%a
        if a < c:
            return gcd(a, c)
        else:
            return gcd(c, a)

sum = 0
for i in range(1, k+1):
    sum += i
for i in range(1, k):
    for j in range(i+1, k+1):
        sum += gcd(i, j) * 6
for i in range(1, k-1):
    for j in range(i+1, k):
        for l in range(j+1, k+1):
            sum += gcd(gcd(i, j), l) * 6
print(sum)
### BUGGY CODE ###

N = int(input())
P = [int(x) for x in input().split()]
count = 0
check = 0
for i in range(N):
    check = 0
    for j in range(i):
        if P[i] > P[j]:
            check = 1
            break
    if check == 0:
        count += 1

print(count)


### FIXED CODE ###

N = int(input())
P = [int(x) for x in input().split()]
count = 0
check = 0
min = 10**9
for i in P:
    check = 0
    if min > i:
        min = i
    if i <= min:
        count += 1

print(count)