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

import collections

N = int(input())
l = [s for s in input().split()]

c = collections.Counter(l)
ans_dict = {}

for i in l:
    if str(i) in ans_dict.keys():
        print(int(ans_dict[str(i)]))
    else:
        c[str(i)] -= 1
        hoge = list(c.values())
        fuga = [(i*(i-1))/2 if i >= 2 else 0 for i in hoge]
        ans = sum(fuga)
        c[str(i)] += 1
        ans_dict[str(i)] = ans
        print(int(ans))

### FIXED CODE ###

import collections

N = int(input())
l = [s for s in input().split()]

c = collections.Counter(l)
ans_dict = {}

hoge = list(c.values())
full_fuga = [(i*(i-1))/2 if i >= 2 else 0 for i in hoge]
full_ans = sum(full_fuga)

for i in l:
    v = c[str(i)]
    if v < 2:
        print(int(full_ans))
    elif v == 2:
        print(int(full_ans - 1))
    elif v > 2:
        print(int(full_ans - ((v*(v-1))/2) + (((v-1) *(v-2))/2)))
### BUGGY CODE ###

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

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
k=a[0]
for i in range(n):
    if a[i]<=k:
        ans+=1
        k=a[i]
print(ans)
### BUGGY CODE ###

from sys import stdin
def main(pS):
    ans = {}
    ac = 0
    wa = 0
    for i in pS:
        if i[0] not in ans.keys():
            ans[i[0]] = [0, 0] 
        if i[1] == "AC":
            if ans[i[0]][0] == 0:
                    ans[i[0]][0] += 1
                    ac += 1
                    wa += ans[i[0]][1]
        elif i[1] == "WA":
            if ans[i[0]][0] == 0:
                ans[i[0]][1] += 1
    return [ac, wa]

"""
for i in ans.values():
    ac += i[0]
    if i[0] >= 1:
        wa += i[1]
"""
if __name__ == "__main__":
    N, M = input().split()
    pS = [stdin.readline().rstrip().split() for _ in range(int(M))]
    ac, wa = main(pS)
    print(ac, wa)

### FIXED CODE ###

from sys import stdin
def main(pS):
    ans = {}
    ac = 0
    wa = 0
    for i in pS:
        if i[0] not in ans.keys():
            ans[i[0]] = [0, 0] 
        if i[1] == "AC":
            if ans[i[0]][0] == 0:
                    ans[i[0]][0] += 1
                    ac += 1
                    wa += ans[i[0]][1]
        elif i[1] == "WA":
            if ans[i[0]][0] == 0:
                ans[i[0]][1] += 1
    return [ac, wa]

"""
for i in ans.values():
    ac += i[0]
    if i[0] >= 1:
        wa += i[1]
"""
if __name__ == "__main__":
    N, M = input().split()
    pS = [stdin.readline().rstrip().split() for _ in range(int(M))]
    ac, wa = main(pS)
    print(ac, wa)
### BUGGY CODE ###

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

Sum = 0

A.sort()
sosuu = []

for i in range(N):

    flag = True

    for j in range(len(sosuu)):
        if A[i] % sosuu[j] == 0:
            flag = False
            break

    if flag:
        if A.count(A[i]) == 1:
            Sum += 1
        sosuu.append(A[i])

print(Sum)


### FIXED CODE ###

from collections import defaultdict

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

DP = [0] * (10 ** 6 + 1)

A.sort()
Sum = 0

d = defaultdict(int)
for key in A:
    d[key] += 1

for i in range(N):

    if DP[A[i]] == 0:
        for j in range(1, 10 ** 6):
            if A[i] * j <= 10 ** 6:
                DP[A[i] * j] = 1
            else:
                break

        if d[A[i]] == 1:
            Sum += 1
print(Sum)
### BUGGY CODE ###

def main():
    N = int(input())
    a = list(map(int, input().split()))
    l = [[10**9+1] * (N+1) for _ in range(N+1)]
    s = [[0] * (N+1) for _ in range(N+1)]
    for i in range(N):
        for j in range(N+1):
            s[i][j] = sum(a[k] for k in range(i, j))
    for i in range(N):
        l[i][i+1] = 0
    for j in range(2, N+1):
        for i in range(N):
            m = i + j
            if m > N:
                continue
            l[i][m] = min(l[i][k] + l[k][m] for k in range(i+1, m)) + s[i][m]
    return l[0][-1]

print(main())


### FIXED CODE ###

def main():
    N = int(input())
    a = list(map(int, input().split()))
    l = [[10**9+1] * (N+1) for _ in range(N+1)]
    s = [[0] * (N+1) for _ in range(N+1)]
    for i in range(N-1):
        for j in range(i+1, N+1):
            s[i][j] = s[i][j-1] + a[j-1]
    for i in range(N):
        l[i][i+1] = 0
    for j in range(2, N+1):
        for i in range(N):
            m = i + j
            if m > N:
                continue
            l[i][m] = min(l[i][k] + l[k][m] for k in range(i+1, m)) + s[i][m]
    return l[0][-1]

print(main())
### BUGGY CODE ###

import itertools

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

ans = set(itertools.combinations(S, 3))
print(len(ans))


### FIXED CODE ###

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

cnt = 0
for i in range(1000):
    key = str(i).zfill(3)
    ki = 0
    for j in range(N):
        if key[ki] == S[j]: ki += 1
        if ki == 3:
            cnt += 1
            break

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

def main():
    from collections import deque

    n, m, k = map(int, input().split())
    f = {i: set() for i in range(1, n+1)}
    BL = {i: set() for i in range(1, n+1)}
    ans = [0] * n
    for _ in range(m):
        a, b = map(int, input().split())
        f[a].add(b)
        f[b].add(a)
    for _ in range(k):
        c, d = map(int, input().split())
        BL[c].add(d)
        BL[d].add(c)
    for i in range(1, n+1):
        ff = f[i].copy()
        q = deque(f[i])
        while q:
            t = q.popleft()
            for x in f[t]:
                if x not in ff:
                    ff.add(x)
                    q.append(x)
        ans[i-1] = max(0, len(ff - f[i] - BL[i]) - 1)
    print(*ans)
main()


### FIXED CODE ###

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

    n, m, k = map(int, input().split())
    f = [[] for i in range(n)]
    BL = [[] for i in range(n)]
    ans = [0] * n
    for _ in range(m):
        a, b = map(int, input().split())
        f[a-1].append(b-1)
        f[b-1].append(a-1)
    for _ in range(k):
        c, d = map(int, input().split())
        BL[c-1].append(d-1)
        BL[d-1].append(c-1)
    D = {}
    parent = [-1] * n
    visited = [False] * n
    for root in range(n):
        if visited[root]:
            continue
        D[root]  = set([root])
        stack = [root]
        while stack:
            x = stack.pop()
            visited[x] = True
            parent[x] = root
            for t in f[x]:
                if visited[t]:
                    continue
                D[root].add(t)
                stack.append(t)
    for i in range(n):
        grp = D[parent[i]]
        tans = len(grp) - len(f[i]) - 1
        for block in BL[i]:
            if block in grp:
                tans -= 1
        ans[i] = tans
    print(*ans)
main()
### BUGGY CODE ###

from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [fetch_int_input() for _ in range(times)]


N, M = fetch_int_input()
gate_len = fetch_int_inputs(M)
range_card = [[False] * N for _ in range(M)]

for gl, rc in zip(gate_len, range_card):
    l = gl[0] - 1
    r = gl[1] - 1
    rc[l: r + 1] = [True] * (r - l + 1)

range_card = list(zip(*range_card))
print(sum([all(r) for r in range_card]))


### FIXED CODE ###

from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [fetch_int_input() for _ in range(times)]


N, M = fetch_int_input()
gate_len = fetch_int_inputs(M)
# range_card = [[False] * N for _ in range(M)]
l, r = 0, N
for gl in gate_len:
    if l < gl[0]:
        l = gl[0]
    if r > gl[1]:
        r = gl[1]

# range_card = list(zip(*range_card))
# print(sum([all(r) for r in range_card]))
result = r - l + 1
if result < 0: result = 0

print(result)
### BUGGY CODE ###

import collections
import itertools

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

ans = 0

for i in range(1,N+1):
  tmp_s_list = list(itertools.combinations(S,i))
  tmp_s_dict = collections.Counter(tmp_s_list)
  for key in tmp_s_dict:
    if max(collections.Counter(key).values()) == 1:
      ans += tmp_s_dict[key]

print(int(ans % (1e9 + 7)))

### FIXED CODE ###

import numpy as np

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

unique_list = list(np.unique(S))

ans = 1

for s in unique_list:
  tmp = S.count(s)
  ans = ans * (tmp + 1)
  
print(int((ans-1) % (10**9 + 7)))
### BUGGY CODE ###

H,W,M = map(int, input().split())
mx=[[0,i] for i in range(W)]
my=[[0,i] for i in range(H)]
bs =[]
for i in range(M):
    y,x = map(int, input().split())
    mx[x-1][0] += 1
    my[y-1][0] += 1
    bs.append((x-1,y-1))

mx.sort(reverse=True)
my.sort(reverse=True)

ans = 0
mxx = 0
myy = 0
for x in mx:
    mxx = max(mxx, x[0])
    if x[0] + 1 < mxx:
        break
    for y in my:
        myy = max(myy, y[0])
        if y[0] + 1 < myy:
            break
        s = x[0] + y[0]
        if (x[1],y[1]) in bs:
            s -= 1
        ans = max(ans, s)
print(ans)


### FIXED CODE ###

H,W,M = map(int, input().split())
mx=[0] * W
my=[0] * H
bs ={}
mxx = 0
myy = 0
for i in range(M):
    y,x = map(int, input().split())
    mx[x-1] += 1
    my[y-1] += 1
    mxx = max(mx[x-1], mxx)
    myy = max(my[y-1], myy)
    if y-1 in bs:
        bs[y-1].add(x-1)
    else:
        bs[y-1] = set([x-1])

vx = []
vy = []
for i,x in enumerate(mx):
    if x == mxx:
        vx.append(i)
for i,y in enumerate(my):
    if y == myy:
        vy.append(i)

a = 1

for i in vx:
    for j in vy:
        if i not in bs[j]:
            a = 0
            break
    else:
        continue
    break

ans = mxx + myy - a
print(ans)
### BUGGY CODE ###


def main():
    n,m = map(int,input().split())
    ab = [[0] * n for i in range(n)]
    for _ in range(m):
        a,b = map(int,input().split())
        ab[a-1][b-1] = 1

    for mid in range(1,n):
        if ab[0][mid] == 1 and ab[mid][n-1] == 1:
            print('POSSIBLE')
            return
    print('IMPOSSIBLE')

if __name__ == '__main__':
    main()


### FIXED CODE ###

n,m = map(int,input().split())
ab = [[-1] for i in range(n)]
for i in range(m):
    a, b = map(int,input().split())
    if ab[a-1][-1] == -1:
        ab[a-1][-1] = b-1
    else:
        ab[a-1].append(b-1)
flg = False
for i, mid in enumerate(ab[0]):
    if n-1 in ab[mid]:
        flg = True
        break

if flg :print('POSSIBLE')
else:print('IMPOSSIBLE')
### BUGGY CODE ###

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

def erat():
    tmp = [False if i == 0 or i == 1 else True for i in range(10 ** 6)]
    for i in range(2, 10 ** 6):
        if tmp[i]:
            for j in range(2 * i, 10 ** 6, i):
                tmp[j] = False
            yield i

for i in erat():
    t = 0
    for j in range(N):
        if A[j] % i == 0:
            t += 1
            A[j] //= i

    if t >= 2:
        p = False

    if t == N:
        s = False
        break

if p:
    print('pairwise coprime')
else:
    print('setwise coprime' if s else 'not coprime')

### FIXED CODE ###

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

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

def erat():
    end = 10 ** 6 + 1
    t = [False if i == 0 or i == 1 else True for i in range(end)]
    ret = [0 for i in range(end)]

    for i in range(2, end):
        if t[i]:
            for j in range(i * 2, end, i):
                t[j] = False
                if not ret[j]:
                    ret[j] = i
            ret[i] = i
    return ret

tmp = A[0]
for i in A[1:]:
    tmp = gcd(tmp, i)
isS = True if tmp == 1 else False
isP = True

e = erat()

D = dict(iter([(i, False) for i in range(10 ** 6 + 1)]))
for i in A:
    tmp = set()
    while i != 1:
        tmp.add(e[i])
        i //= e[i]
    for i in tmp:
        if D[i]:
            isP = False
            break
        else:
            D[i] = True
    if not isP:
        break

if isP:
    print('pairwise coprime')
elif isS:
    print('setwise coprime')
else:
    print('not coprime')
### BUGGY CODE ###

from collections import deque
from itertools import product

h, w = map(int, input().split())
c = tuple(map(lambda x: int(x)-1, input().split()))
d = tuple(map(lambda x: int(x)-1, input().split()))
s = list(input() for _ in range(h))

move_a_area = [(0, -1), (-1, 0), (1, 0), (0, 1)]
move_b_area = [(i, j) for i, j in product(range(-2, 3), repeat=2) if (i, j) not in [0, 0] + move_a_area]

INF = 10**12
cost = [[INF] * w for _ in range(h)]
cost[c[0]][c[1]] = 0
que = deque([(c[0], c[1], 0)])

while que:
    y, x, m = que.popleft()
    # Move A
    for dx, dy in move_a_area:
        hh, ww = y + dy, x + dx
        if 0 <= hh < h and 0 <= ww < w and s[hh][ww] == '.' and cost[hh][ww] > m:
            cost[hh][ww] = m
            que.append((hh, ww, m))
    # Move B
    for dx, dy in move_b_area:
        hh, ww = y + dy, x + dx
        if 0 <= hh < h and 0 <= ww < w and s[hh][ww] == '.' and cost[hh][ww] > m + 1:
            cost[hh][ww] = m + 1
            que.append((hh, ww, m + 1))

print(v if (v := cost[d[0]][d[1]]) < INF else -1)


### FIXED CODE ###

from collections import deque
from itertools import product

h, w = map(int, input().split())
c = tuple(map(lambda x: int(x)-1, input().split()))
d = tuple(map(lambda x: int(x)-1, input().split()))
s = list(input() for _ in range(h))

move_a_area = [(0, -1), (-1, 0), (1, 0), (0, 1)]
move_b_area = [(i, j) for i, j in product(range(-2, 3), repeat=2) if (i, j) not in [(0, 0)] + move_a_area]

cost = [[float('inf')] * w for _ in range(h)]
cost[c[0]][c[1]] = 0
que = deque([(c[0], c[1], 0)])

while que:
    y, x, m = que.popleft()
    # Move A
    for dx, dy in move_a_area:
        hh, ww = y + dy, x + dx
        if hh < 0 or h <= hh or ww < 0 or w <= ww or s[hh][ww] == '#' or cost[hh][ww] <= m:
            continue
        cost[hh][ww] = m
        que.appendleft((hh, ww, m))
    # Move B
    for dx, dy in move_b_area:
        hh, ww = y + dy, x + dx
        if hh < 0 or h <= hh or ww < 0 or w <= ww or s[hh][ww] == '#' or cost[hh][ww] <= m + 1:
            continue
        cost[hh][ww] = m + 1
        que.append((hh, ww, m + 1))

print(cost[d[0]][d[1]] if cost[d[0]][d[1]] < float('inf') else -1)
### BUGGY CODE ###

from collections import deque
N = int(input())
node = [[]for i in range(N)]
side = []
ans = [0]*(N-1)
for i in range(N-1):
    a,b = map(int,input().split())
    side.append([a-1,b-1])
    node[a-1].append(i)
    node[b-1].append(i)

K = max(len(i) for i in node)
print(K)

queue = deque([0])

while queue:
    q = queue.popleft()
    use = [0]*(K+1)
    for i in node[q]:
        use[ans[i]] = 1
    p = 1
    for i in node[q]:
        if ans[i] == 0:
            while use[p]:
                p += 1
            ans[i] = p
            use[p] = 1
            s = side[i]
            queue.append(s[(s.index(q)+1)%2])

for i in ans:
    print(i)


### FIXED CODE ###

from collections import deque
N = int(input())
node = [[]for i in range(N)]
side = []
count = [0]*N
ans = [0]*(N-1)
closed = [0]*N
for i in range(N-1):
    a,b = map(int,input().split())
    side.append([a-1, b-1])
    node[a-1].append(i)
    node[b-1].append(i)
    count[a-1] += 1
    count[b-1] += 1

K = max(count)
print(K)

queue = deque([[0,K+1]])


while queue:
    q,m = queue.popleft()
    p = 1
    for i in node[q]:
        if p == m:
            p += 1
        if ans[i] == 0:
            ans[i] = p
            s = side[i]
            next = s[(s.index(q)+1)%2]
            if closed[next] == 0:
                queue.append([next,p])
                closed[next] = 1
            p += 1

for i in ans:
    print(i)
### BUGGY CODE ###

import bisect
X, Y, A, B, C = map(int, input().split())
P = sorted(list(map(int, input().split())))
Q = sorted(list(map(int, input().split())))
R = sorted(list(map(int, input().split())))

A = P[-X:]
G = Q[-Y:]

for r in R[::-1]:
    if r - min(A[-X], G[-Y]) < 0:
        break

    if A[-X] <= G[-Y]:
        bisect.insort(A, r)
    else:
        bisect.insort(G, r)

# print(A[-X:], G[-Y:])
# print(A[:], G[:])
print(sum(A[-X:]) + sum(G[-Y:]))


### FIXED CODE ###

X, Y, A, B, C = map(int, input().split())
P = sorted(list(map(int, input().split())))
Q = sorted(list(map(int, input().split())))
R = list(map(int, input().split()))

A = sorted(P[-X:] + Q[-Y:] + R)
print(sum(A[-(X+Y):]))
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)

N, Q = map(int, input().split())
c = [int(i) for i in input().split()]
lr = [[int(i) for i in input().split()] for _ in range(Q)]

class SegTree:
  def __init__(self, n) :
    i = 1
    while i < n : 
      i <<= 1
    self.n = i
    self.tree = [set() for _ in range((i << 1))]

  def update(self, i, x) :
    i += self.n - 1
    self.tree[i].add(x)
    while i > 0 :
      i = (i - 1) // 2
      self.tree[i] = self.tree[i * 2 + 1] | self.tree[i * 2 + 2]

  # [l, r)
  def query(self, l, r) :
    l = l + self.n
    r = r + self.n
    s = set()
    while l < r :
      if r & 1 :
        r -= 1
        s |= self.tree[r - 1]
      if l & 1 :
        s |= self.tree[l - 1]
        l += 1
      l >>= 1
      r >>= 1
    return len(s)

ST = SegTree(N + 5)
for i in range(N) :
  ST.update(i, c[i])
 
for l, r in lr :
  print(ST.query(l - 1, r))

### FIXED CODE ###

import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
c = [int(i) for i in input().split()]
lr = [[int(i) - 1 for i in input().split()] for _ in range(Q)]

class BinaryIndexedTree() :
  def __init__(self, n) :
    self.n = n
    self.tree = [0] * (n + 1)
      
  def sum(self, i) :
    s = 0
    while i > 0 :
      s += self.tree[i]
      i -= i & -i
    return s
      
  def add(self, i, x) :
    while i <= self.n :
      self.tree[i] += x
      i += i & -i

BIT = BinaryIndexedTree(N + 5)
sch = [[i, l, r] for i, (l, r) in enumerate(lr)]
sch.sort(key=lambda x: x[2])
ret = [0] * Q
last = [-1] * (N + 1)

cur = 0
for i, l, r in sch :
  while cur <= r :
    BIT.add(cur + 1, 1)
    pos = last[c[cur]]
    if pos != -1 :
      BIT.add(pos + 1, -1)
    last[c[cur]] = cur
    cur += 1
  ret[i] = BIT.sum(r + 1) - BIT.sum(l)
for r in ret :
  print(r)
### BUGGY CODE ###

from sys import exit, stdin

S = list(stdin.readline().rstrip())
ans = [0 for _ in S]

for i, s in enumerate(S):
    flag = True
    if s == 'R':
        index = i
        while flag:
            index += 1
            if S[index] == 'L':
                if (index - i) % 2 == 1:
                    ans[index-1] += 1
                else:
                    ans[index] += 1
                flag = False
    else:
        index = i
        while flag:
            index -= 1
            if S[index] == 'R':
                if (i - index) % 2 == 1:
                    ans[index+1] += 1
                else:
                    ans[index] += 1
                flag = False
print(*ans)

### FIXED CODE ###

from sys import exit, stdin

S = list(stdin.readline().rstrip())
ls = len(S)

candidates = []
for i in range(ls-1):
    if S[i] == 'R' and S[i+1] == 'L':
        candidates.append(i)
lc = len(candidates)

ans = [0 for _ in S]

for i in range(lc):
    l_index, r_index = candidates[i], candidates[i]+1

    while l_index > 0 and S[l_index - 1] == 'R':
        l_index -= 1
    while r_index + 1 < ls and S[r_index + 1] == 'L':
        r_index += 1

    even, odd = 0, 0
    idx = candidates[i]

    for j in range(l_index, idx):
        if (idx-j) % 2 == 0:
            even += 1
        else:
            odd += 1
    for j in range(idx, r_index+1):
        if (j-idx) % 2 == 0:
            even += 1
        else:
            odd += 1
    
    ans[idx] += even
    ans[idx+1] += odd

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

class RollingHash:
    def __init__(self, s, base, mod):
        self.base = base
        self.mod = mod

        self.hash = [0]
        self.power = [1]
        for c in s:
            self.hash.append((self.hash[-1] * base + ord(c)) % mod)
            self.power.append(self.power[-1] * base % mod)

    def get(self, left, right):
        h = self.hash[right] - self.hash[left] * self.power[right - left]
        return (h + self.mod) % self.mod


n = int(input())
s = input().rstrip()
rh = RollingHash(s, base=26, mod=2**50 + 1)


def check(diff):
    d = {}
    for i in range(n - diff + 1):
        h = rh.get(i, i + diff)
        if h in d.keys():
            if abs(d[h] - i) >= diff:
                return True
        else:
            d[h] = i
    return False


lo = 0
hi = n // 2 + 1
while lo + 1 < hi:
    mid = (lo + hi) // 2
    if check(mid):
        lo = mid
    else:
        hi = mid
print(lo)

### FIXED CODE ###

def create_z_array(s):
    n = len(s)
    z_array = [0] * n
    left = 0
    right = 0
    for i in range(1, n):
        if i > right:
            left, right = i, i
            while right < n and s[right - left] == s[right]:
                right += 1
            z_array[i] = right - left
            right -= 1
        else:
            k = i - left
            if z_array[k] < right - i + 1:
                z_array[i] = z_array[k]
            else:
                left = i
                while right < n and s[right - left] == s[right]:
                    right += 1
                z_array[i] = right - left
                right -= 1
    return z_array


n = int(input())
s = input().rstrip()
res = 0
for i in range(n):
    z_array = create_z_array(s[i:])
    for j in range(1, len(z_array)):
        res = max(res, min(j, z_array[j]))
print(res)
### BUGGY CODE ###

def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    l = list(map(int, input().rstrip('\n').split()))
    l.sort()
    cnt = 0
    d = collections.defaultdict(int)
    for i in range(1, n - 1):
        for j in range(i + 1, n):
            a, b = [l[i], l[j]]
            tl = [a + b, abs(a - b)]
            mi = min(tl) + 1
            ma = max(tl) - 1
            for k in range(i-1, -1, -1):
                #print(mi, ma, l[k])
                if l[k] < mi:
                    break
                elif mi <= l[k] <= ma:
                    ttl = sorted([i, j, k])
                    #print(ttl)
                    if (ttl[0], ttl[1], ttl[2]) not in d:
                        d[(ttl[0], ttl[1], ttl[2])]
                        cnt += 1
                    #print(ttl)
    print(cnt)


if __name__ == '__main__':
    slove()


### FIXED CODE ###

def slove():
    import sys
    import collections
    import bisect
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    l = list(map(int, input().rstrip('\n').split()))
    l.sort()
    cnt = 0
    d = collections.defaultdict(int)
    for i in range(n-2):
        for j in range(i+1, n-1):
            ma = l[i] + l[j]
            p = bisect.bisect_left(l, ma)
            if j < p:
                cnt += p - j - 1
    print(cnt)


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

N, M = list(map(int, input().split()))
ahs = list(map(lambda x:int(x)//2, input().split()))

from fractions import gcd
from functools import reduce

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcm = lcm_list(ahs)

result = True
for ah in ahs:
    if (lcm // ah) % 2 == 0:
        result = False
        break

if result == False:
    print(0)
else:
    print((M//lcm-1)//2 + 1)

### FIXED CODE ###

N, M = list(map(int, input().split()))
ahs = list(map(lambda x:int(x)//2, input().split()))

odd = sum([ah % 2 for ah in ahs])
if odd!=0 and N-odd!=0:
    print(0)
else:
    from fractions import gcd
    from functools import reduce

    def lcm_base(x, y):
        return (x * y) // gcd(x, y)

    def lcm_list(numbers):
        return reduce(lcm_base, numbers, 1)

    lcm = lcm_list(ahs)

    result = True
    for ah in ahs:
        if (lcm // ah) % 2 == 0:
            result = False
            break

    if result == False:
        print(0)
    else:
        print((M//lcm-1)//2 + 1)