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

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

### FIXED CODE ###

from collections import Counter
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
sa = []
st = []
for i in range(n):
  sa.append(a[i] + i)
  st.append(i - a[i])
c = defaultdict(int)
c = Counter(st)
sum = 0
for i in range(n-1):
  sum = sum + c[sa[i]]
print(sum)
### BUGGY CODE ###

N = int(input())
alist = list(map(int, input().split()))
k = 1
for i in range(0,N):
    k = k*alist[i]
if k > 1000000000000000000:
    k= -1
print(k)

### FIXED CODE ###

N = int(input())
alist = list(map(int, input().split()))
k = 1
if 0 in alist:
    print(0)
else:
    for i in range(0,N):
        k = k*alist[i]
        if k > 1000000000000000000:
            k= -1
            break
    print(k)
### BUGGY CODE ###

a,b,x = map(int,input().split())
ans = 0
for i in range(a,b+1):
  if i%x==0:
    ans+=1
    
print(ans)

### FIXED CODE ###

a,b,x = map(int,input().split())
ans = 0
if a==0:
  ans=b//x+1
  
else:
  ans = b//x - (a-1)//x
  
print(ans)
### BUGGY CODE ###

a = [0,0,0,0,0,0,0,0,0,0]
a[0] = int(input())

for i in range(9):
  while a[i] != 0:
    a[i+1] += a[i] % 10
    a[i] = a[i] // 10 


if a[9] % 9 == 0:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

a = 0
s = input()
for c in s:
  a += int(c)

if a % 9 == 0:
  print('Yes')
else:
  print('No')
### BUGGY CODE ###

[x,y]=list(map(int,input().split()))
if ((x%3)+(y%3))%3!=0:
	print(0)
else:
	dansu=int((x+y)/3)
	r=y-dansu
	mod=1000000007
	d=1
	rr=1
	nr=1
	for i in range(1,dansu+1):
		d=d*(i%mod)
	for i in range(1,r+1):
		rr=rr*(i%mod)
	for i in range(1,dansu-r+1):
		nr=nr*(i%mod)
	
	kotae=int((d%mod)*((rr**(mod-2))%mod)*((nr**(mod-2))%mod))
	kotae=int(kotae%(10**9+7))
	
	print(kotae)

### FIXED CODE ###

[x,y]=list(map(int,input().split()))
if ((x%3)+(y%3))%3!=0:
	print(0)
else:
	n=int((x+y)/3)
	r=y-n
	if r<0 or r>n:
		print(0)
	else:
		if r>n-r:
			r=n-r
		mod=1000000007
		kaijo=[1]
		for i in range(1,n+1):
			kaijo.append(kaijo[-1]*i%mod) #これで、kaijo[i]=i!となる。
		gyakugen=[pow(kaijo[n-r],mod-2,mod)]
		for i in reversed(range(1,n-r+1)):
			gyakugen.append(gyakugen[-1]*i%mod) #これで、gyakugen[i]=n-r-iの逆元となる
		kotae=kaijo[n]*gyakugen[0]*gyakugen[n-2*r]%mod

		print(kotae)
### BUGGY CODE ###

N,P=map(int,input().split())
ans=1
def make_divisors(n):
    divisors = []
    for i in range(1,int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)

    return divisors
l=make_divisors(P)
l.sort()
#print(l)
for i in range(len(l)):
    a=pow(l[i],N)
    if P//a==0:
        break
    else:
        if P%a==0:
            ans=l[i]
print(ans)

### FIXED CODE ###

N,P=map(int,input().split())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
p=factorization(P)
#print(p)
k=[]
ans=1
for i in range(len(p)):
    d=p[i][1]//N
    k.append(d)
for i in range(len(p)):
    ans*=pow(p[i][0],k[i])
print(ans)
### BUGGY CODE ###

from collections import deque
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
path=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  path[a-1].append(b-1)
  path[b-1].append(a-1)
l=deque()
l.append(0)
while True:
  flag=True
  for i in path[l[0]]:
    if not i in l:
      l.appendleft(i)
      flag=False
      break
  for i in path[l[-1]]:
    if not i in l:
      l.append(i)
      flag=False
      break
  if flag or len(l)==n:
    break
print(len(l))
for i in range(len(l)):
  l[i]+=1
print(*l)

### FIXED CODE ###

from collections import deque
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
path=[[] for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  path[a-1].append(b-1)
  path[b-1].append(a-1)
l=deque()
s=set()
l.append(0)
s.add(0)
while True:
  for i in path[l[0]]:
    if not i in s:
      l.appendleft(i)
      s.add(i)
      break
  else:break
while True:
  for i in path[l[-1]]:
    if not i in s:
      l.append(i)
      s.add(i)
      break
  else:break
print(len(l))
l=list(map(lambda x:x+1,l))
print(*l)
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline


sys.setrecursionlimit(10**9)
from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')

#

def main():
	mod=10**9+7
	n=II()
	G=[[] for _ in range(n+1)]
	p=[0]*(n+1)
	v=[0]*(n+1)


	for _ in range(n-1):
		a,b=MI()
		G[a].append(b)
		G[b].append(a)

	inv2=[1]*(n+1)
	t=pow(pow(2,n,mod),mod-2,mod)
	for i in range(n,-1,-1):
		inv2[i]=t
		t*=2
		t%=mod
	#print(inv2)
	
	@lru_cache(maxsize=None)
	def dfs(a):
		cnt=1
		for i in G[a]:
			if p[a]==i:
				continue
			else:
				p[i]=a
				cnt+=dfs(i)
		v[a]=cnt
		return cnt
	dfs(1)
	#print(v)

	def f(a):
		return (1-inv2[a])*(1-inv2[n-a])%mod

	ans=1-inv2[n]-n*inv2[1]
	for i in range(1,n+1):
		ans+=f(v[i])%mod
	print(ans%mod)




if __name__ == "__main__":
	main()

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
input = sys.stdin.readline
input = sys.stdin.buffer.readline


sys.setrecursionlimit(10**9)
from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')

#

def main():
	mod=10**9+7
	n=II()
	G=[[] for _ in range(n+1)]
	p=[0]*(n+1)
	v=[0]*(n+1)


	for _ in range(n-1):
		a,b=MI()
		G[a].append(b)
		G[b].append(a)

	inv2=[1]*(n+1)
	t=pow(pow(2,n,mod),mod-2,mod)
	for i in range(n,-1,-1):
		inv2[i]=t
		t*=2
		t%=mod
	#print(inv2)

	def dfs(a):
		cnt=1
		for i in G[a]:
			if p[a]==i:
				continue
			else:
				p[i]=a
				cnt+=dfs(i)
		v[a]=cnt
		return cnt
	dfs(1)
	#print(v)

	def f(a):
		return (1-inv2[a])*(1-inv2[n-a])%mod

	ans=1-inv2[n]-n*inv2[1]
	for i in range(1,n+1):
		ans+=f(v[i])%mod
	print(ans%mod)



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

n = int(input())
a = sorted(list(map(int,input().split())))
ans = sum(a)
#print(ans)
q = int(input())
b = []
c = []
for i in range(q):
    bb,cc = map(int,input().split())
    b.append(bb)
    c.append(cc)
#print(b)
#print(c)
from itertools import groupby
d = [[key,len(list(group))] for key,group in groupby(sorted(a))]
#print(d)
for j in range(q):
    for i in range(len(d)):
        if b[j]==d[i][0]:
            d[i][0] = c[j]
            ans = ans + ((c[j]-b[j])*d[i][1])
    print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
s = sum(a)
#print(ans)
q = int(input())
import collections
cc = collections.Counter(a)
#print(cc)
for i in range(q):
    b,c = map(int,input().split())
    tmp = cc[b]
    cc[b] = 0
    s=s-b*tmp+c*tmp
    cc[c]+=tmp
    print(s)
### BUGGY CODE ###

def contract(n, aaa):
    d = n
    aaa_can = [(sum(aaa), aaa)]
    while d > 2:
        next_totals = []
        for i in range(len(aaa_can)):
            total, aaa = aaa_can[i]
            for j in range(1, d - 1):
                next_totals.append((total + aaa[j], i, j))
        next_totals.sort()
        next_can = []
        checked = set()
        for total, i, j in next_totals:
            aaa = aaa_can[i][1]
            aj = aaa[j]
            bbb = aaa[:j] + aaa[j + 1:]
            bbb[j - 1] += aj
            bbb[j] += aj
            ccc = tuple(bbb)
            if ccc in checked:
                continue
            checked.add(ccc)
            next_can.append((total, bbb))
            if len(next_can) >= 20000:
                break
        aaa_can = next_can
        d -= 1
    return aaa_can[0][0]


n = int(input())
aaa = list(map(int, input().split()))
# ans = solve(aaa)
ans = contract(n, aaa)
print(ans)


### FIXED CODE ###

from functools import lru_cache


def solve(n, aaa):
    @lru_cache(maxsize=None)
    def search_min(li, ri, lc, rc):
        w = ri - li
        base = aaa[li] * lc
        if w == 1:
            return base
        lrc = lc + rc
        if w == 2:
            return base + aaa[li + 1] * lrc
        if w == 3:
            a1, a2 = aaa[li + 1], aaa[li + 2]
            return base + (a1 + a2) * lrc + min(a1 * lc, a2 * rc)
        ret = min(search_min(li, i, lc, lrc) + search_min(i, ri, lrc, rc) for i in range(li + 1, ri))
        return ret

    return search_min(0, n - 1, 1, 1) + aaa[-1]


n = int(input())
aaa = list(map(int, input().split()))
print(solve(n, aaa))
### BUGGY CODE ###

N = int(input())
count = 0
for i in range(1, N + 1):
    
    for j in range(1, N // 2):
        for l in range(1, N // 2):
            for r in range(1, N // 2):
                if j ** 2 + l ** 2 + r ** 2 + j * l + j * r + l * r == i:
                    if j == l == r:
                        count = 1
                        break
                    else:
                        count = 3
                        break
                    
    print(count)
    count = 0

### FIXED CODE ###

# # import math
N = int(input())
# # count = 0
# # flag = False
# # # n = int(math.sqrt(N))
n = 105

# # for i in range(1, N + 1):
    
# #     for j in range(1, n):
# #         for l in range(1, n):
# #             for r in range(1, n):
# #                 if j + l + r > N // 2:
# #                     continue
# #                 if j ** 2 + l ** 2 + r ** 2 + j * l + j * r + l * r == i:
# #                     if j == l == r:
# #                         flag = True
# #                         count = 1
# #                         break
# #                     else:
# #                         flag = True
# #                         count = 3
# #                         break
# #             if flag:
# #                 break
# #         if flag:
# #             break            
# #     print(count)
# #     count = 0
# #     flag = False
ans = [0] * 10050
for j in range(1, n):
    for l in range(1, n):
        for r in range(1, n):
            value = j * j  + l * l + r * r + j * l + j * r + l * r
            if value < 10050:
                ans[value] += 1

for i in range(N):
    print(ans[i + 1])
# n = int(input())
# ans = [0 for _ in range(10050)]
# for i in range(1,105):
#     for j in range(1,105):
#         for k in range(1,105):
#             v = i*i+j*j+k*k+i*j+j*k+k*i;
#             if v<10050:
#                 ans[v]+=1   
# for i in range(n):
#     print(ans[i+1])
### BUGGY CODE ###

s = str(input())
t = str(input())

dp = [[0]*3100 for _ in range(3100)]
# dp[i+1][j+1]: s[i], t[j]まで見たときのLCSの長さ

for i in range(len(s)):
  for j in range(len(t)):
    if s[i] == t[j]:
      dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1)
    dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
    dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])

i = len(s)
j = len(t)
ans = ''
while i>0 and j>0:
  if dp[i][j] == dp[i-1][j]:
    i -= 1
  elif dp[i][j] == dp[i][j-1]:
    j -= 1
  else:
    ans = s[i-1] + ans
    i -= 1
    j -= 1
print(ans)

### FIXED CODE ###

s = str(input())
t = str(input())

dp = [[0]*3100 for _ in range(3100)]
# dp[i+1][j+1]: s[i], t[j]まで見たときのLCSの長さ

for i in range(len(s)):
  for j in range(len(t)):
    if s[i] == t[j]:
      dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1)
    dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
    dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])

i = len(s)
j = len(t)
ans = ''
while i>0 and j>0:
  if dp[i][j] == dp[i-1][j]:
    i -= 1
  elif dp[i][j] == dp[i][j-1]:
    j -= 1
  else:
    ans = s[i-1] + ans
    i -= 1
    j -= 1
print(ans)
### BUGGY CODE ###

import itertools

N = int(input())
S = input()

lis = list(itertools.combinations(range(0, N), 3))

cnt=0
for i, j, k in lis:
    if j-i != k-j:
        if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
            cnt+=1

print(cnt)


### FIXED CODE ###

N = int(input())
S = input()

R = [X for X, x in enumerate(S) if x == 'R']
G = [Y for Y, y in enumerate(S) if y == 'G']
B = [Z for Z, z in enumerate(S) if z == 'B']

mae = len(R)*len(G)*len(B)

cnt=0
for i in range(0,N-2):
    for j in range(i+1,N-1):
        k = 2*j-i
        if k >=N:
            break
        if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
            cnt+=1

print(mae-cnt)
### BUGGY CODE ###

import sys
def main():
    INF=sys.maxsize
    N,K=tuple(map(int,sys.stdin.readline().split()))
    h=tuple(map(int,sys.stdin.readline().split()))
    dp=[INF for _ in range(N)]
    dp[0]=0
    for i in range(1,N):
        for j in range(1,K+1):
            if i-j>=0:
                dij=dp[i-j]+abs(h[i]-h[i-j])
                if dij<dp[i]:dp[i] = dij
    print(dp[N-1])
if __name__=='__main__':main()

### FIXED CODE ###

import sys
def main():
    INF=sys.maxsize
    N,K=tuple(map(int,sys.stdin.readline().split()))
    h=tuple(map(int,sys.stdin.readline().split()))
    dp=[INF for _ in range(N)]
    dp[0]=0
    for i in range(N-1):
        for j in range(1,K+1):
            if i+j<N:dp[i+j]=min([dp[i+j],dp[i]+abs(h[i+j]-h[i])])
    print(dp[N-1])
if __name__=='__main__':main()
### BUGGY CODE ###

from collections import deque

S = deque(input())
Q = int(input())

for i in range(Q):
  query = [str(e) for e in input().split()]
  if len(query)==1:
    #文字を反転
    S.reverse()
  else:
    if query[1]=="1":
      #先頭に追加
      S.appendleft(query[2])
    else:
      #末尾に追加
      S.append(query[2])
      
#print(S)
print(''.join(map(str,S)))

### FIXED CODE ###

from collections import deque

S = deque(input())
Q = int(input())
reverse_mode = False #反転毎に全体を反転しているとTLEする
reversed_count = 0
 
for i in range(Q):
    query = [str(e) for e in input().split()]
    if len(query)==1:
        reversed_count += 1
        #反転のモードを切り替える
        if reverse_mode == False:
            reverse_mode = True
        elif reverse_mode == True:
            reverse_mode = False
    
    else:
        if reverse_mode == False:
            if query[1]=="1":
            #先頭に追加
                S.appendleft(query[2])
            else:
            #末尾に追加
                S.append(query[2])
        elif reverse_mode == True:
            if query[1]=="1":
            #反転した先頭に追加＝末尾に追加
                S.append(query[2])
            else:
            #反転した末尾に追加＝先頭に追加
                S.appendleft(query[2])

#終了時に反転回数に応じて逆転orそのままにする
if reversed_count%2 != 0:
    S.reverse()
    
#print(S)
print(''.join(map(str,S)))
### BUGGY CODE ###

def main():
    import collections
    import sys
    input = sys.stdin.readline
    N = int(input())
    uvw = [map(int, input().split()) for i in range(N-1)]

    G = [[-1]*N for i in range(N)]
    for u, v, w in uvw:
        u -= 1
        v -= 1
        G[u][v] = w
        G[v][u] = w
    q = collections.deque()
    q.append((0, 0))
    s = set(range(1, N))
    ans = [0]*N
    while(q):
        x, a = q.popleft()
        tmp = set()
        for y in s:
            if G[x][y] > 0:
                q.append((y, a+G[x][y]))
                ans[y] = (a+G[x][y]) % 2
                tmp.add(y)
        s -= tmp
    print(*ans, sep="\n")
main()


### FIXED CODE ###

import collections
N = int(input())
d = [0]*N
route = [set() for i in range(N)]
for i in range(N-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    route[u].add((v, w))
    route[v].add((u, w))
    d[u] += 1
    d[v] += 1
d = d.index(max(d))
q = collections.deque()
q.append((d, 0))

G = [0]*N

while(q):
    x, l = q.popleft()
    for v, w in route[x]:
        G[v] = w + l
        q.append((v, w+l))
        route[v].remove((x, w))
ans = [0]*N

for i in range(N):
    if i == d:
        continue
    if G[i] % 2 == 1:
        ans[i] = 1
for i in range(N):
    print(ans[i])
### BUGGY CODE ###

import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    N = int(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zeros = [[0] * w for i in range(h)]
    for n in range(1,N+1):
        ans = 0
        for x in range(1,int(n**0.5)+1):
            for y in range(1,int(n**0.5)+1):
                pre = x**2 + y**2 + x*y
                uu = n-pre
                if uu<0:
                    break
                for z in range(1,int(uu**0.5)+1):
                    if z*(z+x+y)==uu:
                        if len(set([x,y,z])) == 1:
                            ans = 1
                            break
                        elif len(set([x,y,z])) == 2:
                            ans = 3
                            break
                        else:
                            ans = 6
                            break
        print(ans)



if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
#import string
#from collections import defaultdict, deque, Counter
#import bisect
#import heapq
#import math
#from itertools import accumulate
#from itertools import permutations as perm
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as combr
#from fractions import gcd
#import numpy as np

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    N = int(stdin.readline().rstrip())
    #A, B, C = map(int, stdin.readline().rstrip().split())
    #l = list(map(int, stdin.readline().rstrip().split()))
    #numbers = [[int(c) for c in l.strip().split()] for l in sys.stdin]
    #word = [stdin.readline().rstrip() for _ in range(n)]
    #number = [[int(c) for c in stdin.readline().rstrip()] for _ in range(n)]
    #zer
    ans = [0]*N
    for x in range(1,int(N**0.5)+1):
        for y in range(1,int(N**0.5)+1):
            for z in range(1,int(N**0.5)+1):
                a = x**2 + y**2 + z**2 +x*y + y*z + z*x
                if a > N:
                    break
                ans[a-1] += 1

    for i in range(N):
        print(ans[i])



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

N = int(input())
a = [int(x) for x in input().split()]
ans = 10**9*N
for i in range(1,N):
    front = a[:i]
    back = a[i:]
    ans = min(ans, abs(sum(front)-sum(back)))
print(ans)

### FIXED CODE ###

N = int(input())
a = [int(x) for x in input().split()]
ans = 10**9*N
front = 0
back = sum(a)
for i in range(N-1):
    front += a[i]
    back -= a[i]
    ans = min(ans, abs(front-back))
print(ans)
### BUGGY CODE ###

n = int(input())

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

count = 1

for i in a:
    count*=i

x = 10**18

if count > x:
    print(-1)
else:
    print(count)

### FIXED CODE ###

n = int(input())

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

count = 1

for i in range(n):
    count*=a[i]
    if count>10**18:
        print(-1)
        break

else:
    print(count)
### BUGGY CODE ###

import math
k = int(input())
a = list(range(1,k+1))
ans = 0
for x in a:
  for y in a:
    for z in a:
      ans += math.gcd(math.gcd(x,y),z)
print(ans)

### FIXED CODE ###

import math
k = int(input())
ans = 0
for x in range(1,k+1):
  for y in range(1,k+1):
    hoge = math.gcd(x,y)
    for z in range(1,k+1):
      ans += math.gcd(hoge,z)
print(ans)
### BUGGY CODE ###

import numpy as np

N, K, Q = map(int, input().split())
A_point = np.full((N, 1), K)

for i in range(Q):

        Ai = int(input())

        A_point[0:Ai-1]   -= 1
        A_point[Ai:N] -= 1

for i in range(len(A_point)):

        print("Yes" if A_point[i][0]>=1 else "No")


### FIXED CODE ###

import numpy as np

N, K, Q = map(int, input().split())
#A_point = np.full((N, 1), K)
A_zero  = np.zeros((N, 1))


for i in range(Q):

        Ai = int(input())
        A_zero[Ai-1][0] += 1

for i in range(N):

        print("Yes" if K-(Q-A_zero[i][0])>=1 else "No")
### BUGGY CODE ###

N,M=map(int,input().split())
a=[]
b=[]
for i in range(0,M):
	c,d=map(int,input().split())
	a.append(c)
	b.append(d)

pos=0
i=0
e=[]
f=[]
k=0
l=0
for i in range(0,M):
	if a[i] == 1:
		e.append(b[i])
		k=k+1
	if b[i] == 1:
		e.append(a[i])
		k=k+1
	if a[i] == N:
		f.append(b[i])
		l=l+1
	if b[i] == N:
		f.append(a[i])
		l=l+1
for i in range(0,k):
	for j in range(0,l):
		if e[i]==f[j]:
			pos = 1
			break
if pos == 1:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")

### FIXED CODE ###

N,M=map(int,input().split())
a=[]
b=[]
for i in range(0,M):
	c,d=map(int,input().split())
	a.append(c)
	b.append(d)

pos=0
i=0
g=[0 for i in range(0,200000)]
e=[]
f=[]
k=0
l=0
while i < M and pos == 0:
	if a[i] == 1:
		g[b[i]] = 1
	if b[i] == 1:
		g[a[i]] = 1
	i=i+1
i=0
while i < M and pos == 0:
	if a[i] == N:
		if g[b[i]] == 1:
			pos=1
	if b[i] == N:
		if g[a[i]] == 1:
			pos=1
	i = i + 1
if pos == 1:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")
### BUGGY CODE ###

from statistics import mean
while True:
  n=int(input())
  c=0
  if n==0:
    break
  ns=list(map(int, input().split()))
  for i in range(n):
    if ns[i]<=mean(ns):
      c+=1
  print(c)


### FIXED CODE ###

while True:
  n=int(input())
  c=0
  if n==0:
    break
  ns=list(map(int, input().split()))
  for i in range(n):
    if ns[i]<=sum(ns)/n:
      c+=1
  print(c)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(101000)

N=input()

memo={}
def dp(n):
	ret=float("inf")
	if n==0: return 0
	if n<0: return float("inf")
	if n in memo: return memo[n]

	for k in range(1,8):
		t=min(dp(n-6**k)+1,dp(n-9**k)+1,dp(n-1)+1)
		ret=min(ret,t)
	
	memo[n]=ret
	return ret

#print dp(8)
#print dp(12)
#print dp(83)
#print dp(N)
dp(N)
print memo[N]


### FIXED CODE ###

import copy
N=input()

def nine(m):
	if m<9: return m
	for i in range(1000):
		t=9**i
		if t>m:
			t1=9**(i-1)
			return m-t1
def six(m):
	if m<6: return m
	for i in range(1000):
		t=6**i
		if t>m:
			t2=6**(i-1)
			return m-t2


Z=15
k=1<<Z

b=set()
for i in range(k):

	n=copy.deepcopy(N)
	ans=0
	for j in range(Z):
		if n<6:
			b.add(ans+n)
			break
		if i&(1<<j)!=0:
			#9
			n=nine(n)
			ans+=1
		else:
			#6
			n=six(n)
			ans+=1


print min(b)
### BUGGY CODE ###

N = int(input())
S = [input() for _ in range(N)]

key = set(S)

_dict = {}
for s in key:
    _dict[s] = S.count(s)

sort_dict = sorted(_dict.items(), key=lambda x: -x[1])
c = sort_dict[0][1]
lst = list()
for item in sort_dict:

    if c == item[1]:
        lst += [item[0]]
        c = item[1]
    else:
        break

lst.sort()

for i in lst:
    print(i)


### FIXED CODE ###

from collections import Counter

N = int(input())
S = [input() for _ in range(N)]

c = Counter(S)
_max = max(c.values())

ans = []
for k, v in c.items():
    if v == _max:
       ans += [k]

for a in sorted(ans):
    print(a)