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


import collections

N = int(input())

input_line = input()
Line = input_line.split()
Line = [int(s) for s in Line]

for i in range(1,N+1):
    print(Line.count(i))

### FIXED CODE ###

import collections

N = int(input())

input_line = input()
Line = input_line.split()
Line = [int(s) for s in Line]

c = collections.Counter(Line)

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

N = int(input())
c = input()
cnt = 0
r_cnt = c.count('R')
w_cnt = c.count('W')
ans = 'R' * r_cnt
if not w_cnt or not r_cnt:
  print(cnt)
else:
  while True:
    if c[:r_cnt] == ans:
      break
    else:
      w_index = c.index('W')
      r_index = N-c[::-1].index('R')-1
      c = c[:w_index] + 'R' + c[w_index+1:r_index] + 'W' + c[r_index+1:]
      cnt += 1
  print(cnt)

### FIXED CODE ###

from collections import deque
N = int(input())
c = deque(list(input()))
cnt = 0
def left(c):
  l = c.popleft()
  return l
def right(c):
  r = c.pop()
  return r
while c:
  l = left(c)
  if l == 'R':
    continue
  else:
    while True:
      if not c:
        break
      r = right(c)
      if r == 'W':
        continue
      else:
        cnt += 1
        break
print(cnt)
### BUGGY CODE ###

h = [int(input())]
counter = 0
while True:
    if(h == []):
        print(counter)
        break
    t = h[0]
    h = ([t / 2, t / 2] if t / 2 >= 1 else []) + h[1:]
    counter += 1


### FIXED CODE ###

def a(x):
    if x == 1: return 1
    if x > 1: return a(x // 2) * 2 + 1

print(a(int(input())))
### BUGGY CODE ###

import itertools
n=int(input())
s=input()
p = itertools.combinations(range(n),3)
l=[]
for a,b,c in p:
    x=s[a]+s[b]+s[c]
    l.append(x)
print(len(set(l)))

### FIXED CODE ###

n=int(input())
s=input()
ans=0
for i in range(1000):
    num=str(i).zfill(3)
    if s.find(num[0])==-1:
        continue
    s1=s[s.find(num[0])+1:]
    if s1.find(num[1])==-1:
        continue
    s2=s1[s1.find(num[1])+1:]
    if s2.find(num[2])==-1:
        continue
    ans+=1
print(ans)
### BUGGY CODE ###

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

ans = 0
for i in range(1,n+1):
    list = sorted(listn[:i])
    if listn[i-1]==list[0]:
        ans+=1

print(ans)
    

### FIXED CODE ###

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

a = 10**6
ans = 0
for i in range(n):
    if listn[i] <= a:
        a = listn[i]
        ans += 1

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

n = int(input())
a = list(map(int, input().split()))
mx = max(a)

dp = [0] * (mx+1)
for i in a:
    if dp[i] == 1:
        continue
    j = 2
    while i * j <= mx:
        dp[i*j] = 1
        j += 1

cnt = 0
for i in a:
    if dp[i] == 0 and a.count(i) == 1:
        cnt += 1

print(cnt)

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
mx = max(a)
a.sort()
c = Counter(a)

dp = [0] * (mx+1)
for i in a:
    if dp[i] == 1:
        continue
    j = 2
    while i * j <= mx:
        dp[i*j] = 1
        j += 1

cnt = 0
for i in set(a):
    if dp[i] == 0 and c[i] == 1:
        cnt += 1

print(cnt)
### BUGGY CODE ###

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

ans = 0
for i, v in enumerate(A):
    flag = True    
    for j, w in enumerate(A):
        if j == i: continue
        if v % w == 0:
            flag = False
            break
    if flag: ans += 1
print(ans)

### FIXED CODE ###

from numba import njit

N = int(input())
A = list(map(int, input().split()))
maxA = max(A)
dp = [0] * maxA

for i in range(N):
    if dp[A[i]-1] != 0:
        dp[A[i]-1] = 2
        continue
    else:
        for j in range(1, maxA//A[i]+1):
            dp[A[i]*j-1] += 1

ans = 0
for i in range(N):
    if dp[A[i]-1] == 1:
        ans += 1

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

n, m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]
nl = [[] for i in range(n+1)]
for a,b in s: nl[a].append(b)
can = False
for i in range(2,n):
    if i in nl[1] and n in nl[i]: can = True 
ans = "POSSIBLE" if can else "IMPOSSIBLE"
print(ans)

### FIXED CODE ###

n, m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]
nl = [[0,0] for i in range(n+1)]
for a,b in s:
    if a == 1: nl[b][0] = 1
    if b == n: nl[a][1] = 1
ans = "POSSIBLE" if [1,1] in nl else "IMPOSSIBLE"
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
cnt = 0
for _ in range(int(stdin.readline())):
    n = int(stdin.readline())
    for i in xrange(2, n):
        if n % i == 0:
            break
    else:
        cnt += 1
print(cnt)

### FIXED CODE ###

#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
from math import sqrt
n = int(stdin.readline())
cnt = 0
for _ in range(n):
    v = int(stdin.readline())
    if v == 2:
        cnt += 1
    elif v % 2 == 1:
        for i in xrange(3, int(sqrt(v))+1, 2):
            if v % i == 0:
                break
        else:
            cnt += 1
print(cnt)
### BUGGY CODE ###

count = int(input())
numbers = map(int, input().split(' '))

counter = 0
while True:
  tmp = 0
  for item in numbers:
    tmp += item % 2
  if tmp > 0:
    break
  counter += 1
  numbers = [item / 2 for item in numbers]
  if numbers.count(0):
    break
print(counter)

### FIXED CODE ###

count = int(input())
numbers = [int(num) for num in input().split()]

counter = 0
while True:
  tmp = 0
  for item in numbers:
    tmp += item % 2
  if tmp > 0:
    break
  counter += 1
  numbers = [item / 2 for item in numbers]
print(counter)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
import numpy as np


n, t = map(int, input().split())

DISHES = [(0, 0)]
for _ in range(n):
    a, b = map(int, input().split())
    DISHES.append((a, b))
DISHES.sort()

DP = np.zeros((n + 1, t + 1), dtype = int)
for i in range(1, n + 1):
    for j in range(1, t + 1):
        a, b = DISHES[i][0], DISHES[i][1]
        if j - a < 0:
            DP[i][j] = DP[i - 1][j]
        else:
            DP[i][j] = max(DP[i - 1][j], DP[i - 1][j - a] + b)

for k in range(1, n + 1):
    DP[k][t] = DP[k - 1][t - 1] + DISHES[k][1]

print(np.max(DP))


### FIXED CODE ###

import sys
input = sys.stdin.readline


n, t = map(int, input().split())

DISHES = [(0, 0)]
for _ in range(n):
    a, b = map(int, input().split())
    DISHES.append((a, b))
DISHES.sort()

DP = [[0] * (t + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
    a, b = DISHES[i]
    for j in range(1, t + 1):
        if j - a < 0:
            DP[i][j] = DP[i - 1][j]
        else:
            DP[i][j] = max(DP[i - 1][j], DP[i - 1][j - a] + b)

answer = 0
for k in range(1, n + 1):
    answer = max(answer, DP[k - 1][t - 1] + DISHES[k][1])

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

from collections import deque


def bfs(S):  # 幅優先探索  # キュー
    dist = [[-1] * w for _ in range(h)]  # 前処理
    que, frag = deque(), set()
    for i, Si in enumerate(S):
        for j, Sij in enumerate(Si):
            if Sij == '#':
                dist[i][j] = 0
                que.append((i, j)), frag.add((i, j))

    while len(que) > 0:
        (x, y) = que.popleft()
        near = [(x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)]
        for i, j in near:  # 移動先の候補
            if ((i, j) in frag):  # 処理済みか否か
                continue
            if 0 <= i < h and 0 <= j < w:
                dist[i][j] = dist[x][y] + 1
                que.append((i, j)), frag.add((i, j))
    return dist


h, w = map(int, input().split())
a = [input() for _ in range(h)]
ans = bfs(a)
print(max(max(ansi) for ansi in ans))


### FIXED CODE ###

from collections import deque


def bfs(S):  # 幅優先探索  # キュー
    dist = [[-1] * w for _ in range(h)]  # 前処理
    que = deque()
    for i, Si in enumerate(S):
        for j, Sij in enumerate(Si):
            if Sij == '#':
                dist[i][j] = 0
                que.append((i, j))

    while len(que) > 0:
        (x, y) = que.popleft()
        near = [(x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)]
        for i, j in near:  # 移動先の候補
            if 0 <= i < h and 0 <= j < w and dist[i][j] < 0:
                dist[i][j] = dist[x][y] + 1
                que.append((i, j))
    return dist[x][y]


h, w = map(int, input().split())
a = [input() for _ in range(h)]
print(bfs(a))
### BUGGY CODE ###

import sys

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

N = ir()
T = lr()
A = lr()
MOD = 10 ** 9 + 7

T_spe = [T[0]] + [0] * (N-1)
A_spe = [0] * (N-1) + [A[-1]]

for i in range(1, N):
    if T[i] > T[i-1]:
        T_spe[i] = T[i]

for i in range(N-2, -1, -1):
    if A[i] > A[i+1]:
        A_spe[i] = A[i]

for i in range(N):
    if T_spe[i] > A[i] or A_spe[i] > T[i]:
        print(0)
        exit()

answer = 1
for i in range(N):
    if T_spe[i] == 0 and A_spe[i] == 0:
        answer *= min(T[i], A[i])

print(answer%MOD)
# 34

### FIXED CODE ###

import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)

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

N = ir()
T = np.array(lr()).astype('int64')
A = np.array(lr()).astype('int64')
MOD = 10 ** 9 + 7

T_low = T.copy()
T_low[1:][T[1:] <= T[:-1]] = 1
A_low = A.copy()
A_low[:-1][A[:-1] <= A[1:]] = 1

lower = np.maximum(T_low, A_low)
upper = np.minimum(T, A)
domain = np.maximum(0, upper - lower + 1) #変域が0の時は記録が間違い
L = len(domain); LSQ = int(L**.5 + 1)
domain = np.resize(domain, LSQ**2) #行列の形に無理やりする下準備（1次元）
domain[L:] = 1 #後半は全部1
domain = domain.reshape((LSQ, LSQ))
for n in range(1, LSQ):
    domain[:, n] *= domain[:, n-1]; domain[:, n] %= MOD
for n in range(1, LSQ):
    domain[n] *= domain[n-1, -1]; domain[n] %= MOD
answer = domain[-1, -1]
print(answer)
### BUGGY CODE ###

N=int(input())
lst=[N%1]
for i in range(2,N+1):
    lst.append((i-1)%i)
print(sum(lst))

### FIXED CODE ###

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

import sys


# \n
def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    S = list(input())

    ok = 0
    ng = N // 2
    ans = 0
    for i in range(N - 1):
        for j in range(i + 1, N):
            if min(j - i, N - j) + 1 < ans:
                continue
            for k in range(0, min(j - i, N - j)):
                if S[i + k] != S[j + k]:
                    ans = max(ans, k)
                    break
            else:
                ans = max(ans, k + 1)
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys


# \n
def input():
    return sys.stdin.readline().rstrip()


def main():
    N = int(input())
    S = list(input())



    ans =0
    for k in range(1,N):
        i=0
        count =0
        while i<N-k:
            if S[i]==S[i+k]:
                count+=1
                ans =max(ans,min(count,k))
            else:
                count=0

            i+=1

    print(ans)









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

import itertools

N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

n = [i for i in range(N)]
ind = []
for i in range(1, N + 1):
    ind += list(itertools.combinations(n, i))

# print(ind)

M = len(ind)
ans = 0
for val in ind:
    X = 0
    Y = 0
    for v in val:
        X += V[v]
        Y += C[v]
        c = X - Y
    ans = max(ans, c)
print(ans)

### FIXED CODE ###

N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0
for i in range(N):
    X = V[i] - C[i]
    if X > 0:
        ans += X
print(ans)
### BUGGY CODE ###

import math
import bisect
N, D, A = list(map(int, input().split()))
data = []
for _ in range(N):
    x, h = list(map(int, input().split()))
    data.append((x, h))
data = sorted(data, key=lambda x: x[0])

loc = {}
for x, h in data:
    loc[x] = bisect.bisect_right([x for x, _ in data], x+2*D)

c = 0
for i in range(N):
    x, h = data[i]
    if h <= 0:
        continue

    # 爆破回数
    attack = math.ceil(h / A)
    c += attack

    # 爆破場所
    # x + D
    for j in range(i+1, loc[x]):
        _x, _h = data[j]        
        if _x <= x + D + D:
            _h -= A * attack
            data[j] = (_x, _h)
        else:
            break

print(c)

    


### FIXED CODE ###

import math
from collections import deque

N, D, A = list(map(int, input().split()))
data = []
for _ in range(N):
    x, h = list(map(int, input().split()))
    data.append((x, math.ceil(h/A)))
data = sorted(data, key=lambda x: x[0])

c = 0
damage_que = deque()
attack = 0 # 有効なダメージ合計
for i in range(N):
    x, h = data[i]

    # 爆破範囲が届いていなければ削除していく
    while damage_que and x > damage_que[0][0]:
        _, a = damage_que.popleft()
        attack -= a
    
    # 有効な過去の爆破攻撃を受ける
    remain = max(h - attack, 0)
    # 0になるまで爆破    
    attack += remain
    c += remain

    # 爆破回数追加    
    damage_que.append([x+2*D, remain])

print(c)
### BUGGY CODE ###

class unionfind:
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)
    def find(self, x):
        if(self.root[x] < 0):
            return x
        else:
            self.root[x] = self.find(self.root[x])
            return self.root[x]
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if(x == y):
            return 
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def count(self, x):
        return -self.root[self.find(x)]
import sys
input=sys.stdin.readline
n=int(input())
l=sorted([tuple(map(int,input().split())) for i in range(n)])
import collections
d=collections.defaultdict(int)
j=1
for i in l:
    if d[i]==0:
        d[i]=j
        j+=1
from heapq import heappush,heappop
pq=[]
for i in range(n-1):
    c=l[i+1][0]-l[i][0]
    heappush(pq,(c,d[l[i]],d[l[i+1]]))
l.sort(key=lambda x:x[1])
for i in range(n-1):
    c=l[i+1][1]-l[i][1]
    heappush(pq,(c,d[l[i]],d[l[i+1]]))
ans=0
uf=unionfind(n)
while pq:
    c,x,y=heappop(pq)
    if not uf.same(x,y):
        ans+=c
        uf.unite(x,y)
print(ans)

### FIXED CODE ###

class unionfind:
    def __init__(self, n):
        self.n = n
        self.root = [-1]*(n+1)
        self.rnk = [0]*(n+1)
    def find(self, x):
        if(self.root[x] < 0):
            return x
        else:
            self.root[x] = self.find(self.root[x])
            return self.root[x]
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if(x == y):
            return 
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    def same(self, x, y):
        return self.find(x) == self.find(y)
    def count(self, x):
        return -self.root[self.find(x)]
import sys
input=sys.stdin.readline
n=int(input())
l=[tuple(map(int,input().split())) for i in range(n)]
l.sort(key=lambda x:x[0])
import collections
d=collections.defaultdict(int)
j=1
for i in l:
    if d[i]==0:
        d[i]=j
        j+=1
pq=[]
for i in range(n-1):
    pq.append((l[i+1][0]-l[i][0],d[l[i]],d[l[i+1]]))
l.sort(key=lambda x:x[1])
for i in range(n-1):
    pq.append((l[i+1][1]-l[i][1],d[l[i]],d[l[i+1]]))
ans=0
pq.sort(key=lambda x:x[0])
uf=unionfind(n)
for c,x,y in pq:
    if not uf.same(x,y):
        ans+=c
        uf.unite(x,y)
print(ans)
### BUGGY CODE ###

import numba
import numpy as np
N = int(input())
P = np.array([int(c)-1 for c in input().split()])
@numba.njit("void(i8,i8[:])")
def proc(N, P):
    ans = 0
    Removed = np.zeros((N, N), dtype=np.int32)
    Mat = np.zeros((N, N), dtype=np.int32)
    Dy, Dx = [1,0,-1,0], [0,1,0,-1]

    for y in range(N):
        for x in range(N):
            Mat[y, x] = min(y, N-1-y, x, N-1-x)
    #print(Mat)
    for i in range(N*N):
        p = P[i]
        y, x = divmod(p, N)
        ans += Mat[y][x]
        #print(p, Mat[y][x])
        Removed[y][x] = True
        #Mat[y][x] -= 1
        st = [(y, x)]
        while st:
            vy, vx = st.pop()
            vr = Removed[vy][vx]
            val = Mat[vy][vx]
            for dy, dx in zip(Dy, Dx):
                uy = vy + dy
                ux = vx + dx
                if not (0<=uy<N and 0<=ux<N):
                    continue
                ur = Removed[uy][ux]
                if vr:
                    if Mat[uy][ux] >= val+1:
                        Mat[uy][ux] = val
                        st.append((uy, ux))
                else:
                    if Mat[uy][ux] >= val+2:
                        Mat[uy][ux] = val+1
                        st.append((uy, ux))
    # for m in Mat:
    #     print(m)
    print(ans)
proc(N, P)



### FIXED CODE ###

import numba
import numpy as np
N = int(input())
P = np.array([int(c)-1 for c in input().split()])

#from random import shuffle
#N = 500
#P = list(range(N*N))
#shuffle(P)
#P = np.array(P)

@numba.njit("void(i8,i8[:])")
def proc(N, P):
    ans = 0
    Removed = np.zeros((500, 500), dtype=np.int8)
    Mat = np.zeros((500, 500), dtype=np.int16)
    Dy, Dx = [1,0,-1,0], [0,1,0,-1]

    for y in range(N):
        for x in range(N):
            Mat[y, x] = min(y, N-1-y, x, N-1-x)
    #print(Mat)
    for i in range(N*N):
        p = P[i]
        y, x = divmod(p, N)
        ans += Mat[y,x]
        Removed[y,x] = 1
        st = [(y, x)]
        while st:
            vy, vx = st.pop()
            vr = Removed[vy,vx]
            val = Mat[vy,vx]
            #for dy, dx in zip(Dy, Dx):
            for j in range(4):
                dy = Dy[j]
                dx = Dx[j]
                uy = vy + dy
                ux = vx + dx
                if not (0<=uy<N and 0<=ux<N):
                    continue
                ur = Removed[uy,ux]
                if vr:
                    if Mat[uy,ux] >= val+1:
                        Mat[uy,ux] = val
                        st.append((uy, ux))
                else:
                    if Mat[uy,ux] >= val+2:
                        Mat[uy,ux] = val+1
                        st.append((uy, ux))
    # for m in Mat:
    #     print(m)
    print(ans)
proc(N, P)
### BUGGY CODE ###

from collections import deque
n = int(input())
v = list(map(int,input().split()))
v = deque(v)

def gcd(a,b):
  while b != 0:
    a, b = b, a % b
  return a

ans = 1
for i in range(n):
    v1 = v.popleft()
    g = 0
    for j in range(n-1):
        g = gcd(g, v[j])
    v.append(v1)
    ans = max(ans,g)
print(ans)


### FIXED CODE ###

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

def gcd(a,b):
  while b != 0:
    a, b = b, a % b
  return a

l_ans = [0] * n
g = 0
for i in range(1, n):
    g = gcd(g, v[i-1])
    l_ans[i] = g
r_ans = [0] * n
g = 0
for i in range(1, n):
    g = gcd(g, v[n-i])
    r_ans[i] = g
r_ans.reverse()
ans = 1
for i in range(n):
    ans = max(ans, gcd(l_ans[i], r_ans[i]))
print(ans)
### BUGGY CODE ###

from math import ceil

R, G, B, n = map(int, input().split())
rm = ceil(n / R)
gm = ceil(n / G)
bm = ceil(n / B)
ans = 0
for r in range(rm+1):
    for g in range(gm+1):
        x = n-(r*R+g*G)
        if x >= 0:
            ans += (x%B == 0)

print(ans)


### FIXED CODE ###

from math import ceil

R, G, B, n = map(int, input().split())
rm = ceil(n / R)
gm = ceil(n / G)
bm = ceil(n / B)
ans = 0
for r in range(rm+1):
    for g in range(gm+1):
        x = n-(r*R+g*G)
        if x >= 0:
            ans += (x%B == 0)

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

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

ans = 0
mod = int(1e9+7)
for i in range(61):
    tmp = 0
    for j in A:
        tmp += (j>>i)&1
    ans += (N-tmp)*tmp*pow(2,i,mod)

print(ans%mod)

### FIXED CODE ###

import numpy as np 

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

A = np.array(A,np.int64)##Ai<2^60

ans = 0
mod = int(1e9+7)

for i in range(60+1):
    bottom_bit = (A>>i)&1 ##i回シフトしたときの最下位bit
    ones = np.sum(bottom_bit[bottom_bit>0])
    ##ans += (N-ones)*ones*(2**i) ##0の個数*1の個数*2^i個
    tmp = ones*(N-ones)
    for j in range(i):
        tmp = (tmp * 2) % mod
    ans += tmp

print(ans%mod)
### BUGGY CODE ###

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

s=[['#']*(w+2)]
for i in range(h):
    s.append(['#']+list(input())+['#'])
s.append([['#']*(w+2)])

l=[[0]*(w+2) for _ in range(h+2)]
r=[[0]*(w+2) for _ in range(h+2)]
u=[[0]*(w+2) for _ in range(h+2)]
d=[[0]*(w+2) for _ in range(h+2)]

for i in range(1, h+1):
    for j in range(1, w+1):
        if s[i][j]=='.':
            l[i][j]=l[i][j-1]+1
            u[i][j]=u[i-1][j]+1
        if s[i][w+1-j]=='.':
            r[i][w+1-j]=r[i][w+2-j]+1
        if s[h+1-i][j]=='.':
            d[h+1-i][j]=d[h+2-i][j]+1

ans=0
for i in range(1, h+1):  # hはy座標
    for j in range(1, w+1):  # wはx座標
        tmp_ans=l[i][j]+r[i][j]+u[i][j]+d[i][j]-3
        ans=max(ans, tmp_ans)
print(ans)


### FIXED CODE ###

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

s=[['#']*(w+2)]
for i in range(h):
    s.append(['#']+list(input())+['#'])
s.append([['#']*(w+2)])

l=[[0]*(w+2) for _ in range(h+2)]
r=[[0]*(w+2) for _ in range(h+2)]
u=[[0]*(w+2) for _ in range(h+2)]
d=[[0]*(w+2) for _ in range(h+2)]

for i in range(1, h+1):
    for j in range(1, w+1):
        if s[i][j]=='.':
            l[i][j]=l[i][j-1]+1
            u[i][j]=u[i-1][j]+1
        if s[i][w+1-j]=='.':
            r[i][w+1-j]=r[i][w+2-j]+1
        if s[h+1-i][j]=='.':
            d[h+1-i][j]=d[h+2-i][j]+1

ans=0
for i in range(1, h+1):  # hはy座標
    for j in range(1, w+1):  # wはx座標
        tmp_ans=l[i][j]+r[i][j]+u[i][j]+d[i][j]-3
        ans=max(ans, tmp_ans)
print(ans)
### BUGGY CODE ###

import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    N, P = lr()
    S = list(map(int, list(sr())))
    if P == 2 or P == 5:
        ans = 0
        for i in range(N):
            if S[i]%P == 0:
                ans += i+1
        print(ans)
        return
    S = S[::-1]
    lp = [0]*P
    c = 0
    for i in range(N):
        d = S[i]*10**i
        c = (c+d)%P
        lp[c] += 1
    ans = lp[0]
    for i in range(P):
        ans += lp[i]*(lp[i]-1)//2
    print(ans)
resolve()

### FIXED CODE ###

import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    N, P = lr()
    S = list(map(int, list(sr())))
    if P == 2 or P == 5:
        ans = 0
        for i in range(N):
            if S[i]%P == 0:
                ans += i+1
        print(ans)
        return
    S = S[::-1]
    lp = [0]*P
    c = 0
    for i in range(N):
        d = S[i]*pow(10,i,P)
        c = (c+d)%P
        lp[c] += 1
    ans = lp[0]
    for i in range(P):
        ans += lp[i]*(lp[i]-1)//2
    print(ans)
resolve()
### BUGGY CODE ###

n = input()
t = [int(i) for i in input().split()]
ans = []
for i in t:
  if i in ans:
    continue
  c = t.count(i)
  if c >= 2:
    if c >= 4:
      ans.extend([i,i])
    else:
      ans.append(i)
ans.sort()
if len(ans) < 2:
  print(0)
else:
  print(ans[-1]*ans[-2])


### FIXED CODE ###

from collections import defaultdict

input()
t = defaultdict(lambda: 0)
for e in [int(i) for i in input().split()]:
  t[e] += 1
ans = []
for k, v in t.items():
  if v >= 2:
    if v >= 4:
      ans.extend([k, k])
    else:
      ans.append(k)
ans.sort()
if len(ans) < 2:
  print(0)
else:
  print(ans[-1]*ans[-2])