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

import numpy as np
N = int(input())
temp = input()
a = np.array([int(i) for i in temp.split()])

num_X = 0

for ele in a:
    X_new = 0
    X_new += sum([ 1 for i in a-ele if i == 0 ])
    X_new += sum([ 1 for i in a-ele-1 if i == 0 ])
    X_new += sum([ 1 for i in a-ele+1 if i == 0 ])
    num_X = max(num_X, X_new)

print(num_X)

### FIXED CODE ###

import numpy as np
N = int(input())
temp = input()
a = np.array([int(i) for i in temp.split()])

list_X = [0]*1000000

for ele in a:
    list_X[ele] += 1
    list_X[ele-1] += 1
    list_X[ele+1] += 1

print(max(list_X))
### BUGGY CODE ###

import bisect

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

l = sorted(l)
ans = 0
for i in range(n):
    a = l[i]
    for j in range(i + 1, n):
        b = l[j]
        shita = max(a - b, b - a)
        ue = a + b
        ans += bisect.bisect_left(l, ue) - bisect.bisect_right(l, shita)
        if shita < a < ue:
            ans -= 1
        if shita < b < ue:
            ans -= 1

print(ans // 3)

### FIXED CODE ###

import bisect

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

l = sorted(l)
ans = 0
for i in range(n):
    a = l[i]
    for j in range(i + 1, n):
        b = l[j]
        shita = max(a - b, b - a)
        ue = a + b
        ans += bisect.bisect_left(l, ue) - bisect.bisect_right(l, shita)
        if shita < a < ue:
            ans -= 1
        if shita < b < ue:
            ans -= 1

print(ans // 3)
### BUGGY CODE ###

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

DP = {0: 0}
for i in range(N):
    wi, vi = map(int, input().split())
    DP_dst = DP.copy()
    for j in DP:
        if j+wi <= W:
            DP_dst[j+wi] = max(DP.get(j+wi, 0), DP[j]+vi)
    DP = DP_dst
print(max((DP[x] for x in DP)))


### FIXED CODE ###

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

DP = [-1] * (W+1)
DP[W] = 0

def maxv(i, v):
    if i >= 0:
        if v > DP[i]:
            DP[i] = v

for w, v in (map(int, input().split()) for _ in range(N)):
    for i in range(1, W+1):
        if DP[i] >= 0:
            maxv(i-w, DP[i]+v)
            maxv(0, DP[i-w])

print(DP[0])
### BUGGY CODE ###

a,b,k=map(int,input().split())
nums=[]

for i in range(a,b+1):
    nums.append(i)

nums2=sorted(nums,reverse=True)

#ans作成
ans=[]
for j in nums[:k]:
    ans.append(j)

for x in nums2[:k]:
    ans.append(x)
ans=sorted(set(ans))

if (b-a)+1<k:
    for y in nums:
        print(y)

else:
    for z in ans:
        print(z)


### FIXED CODE ###

a,b,k=map(int,input().split())

if b-a+1>=2*k:
    aa=[a+i for i in range(k)]
    bb=[b-i for i in range(k)]
    cc=sorted(aa+bb)
    for s in cc:
        print(s)
else:
    for n in range(a,b+1):
        print(n)
### BUGGY CODE ###

a, b, k = map(int,input().split())

ans = {i for i in range(a,b+1) if (i < a+k)or(i>b-k) }

ans = sorted(list(ans))

for an in ans: print(an) 

### FIXED CODE ###

a, b, k = map(int,input().split())

ans = {i for i in range(a,min(a+k,b+1))}
ans2 = {i for i in range(b,max(b-k,a-1),-1)}

ans = ans | ans2
ans = sorted(list(ans))

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

def d(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

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

ad = set(d(a))
bd = set(d(b))

cd = ad & bd

cnt = 0

for i in cd:
    if len(d(i)) == 2:
        cnt += 1

print(cnt+1)

### FIXED CODE ###

def d(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

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

ad = set(d(a))
bd = set(d(b))

cd = ad & bd

cnt = 0

for i in cd:
    if len(d(i)) == 2:
        cnt += 1

print(cnt+1)
### BUGGY CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)
costs = [(ai * fi, fi) for ai, fi in zip(a, f)]
costs.sort(reverse=True)
# l impossible, r ok
l, r = -1, costs[0][0]
while(r - l > 1):
    c = (l + r) // 2
    train = 0
    for cost, step in costs:
        if cost > c:
            train += (cost - c + step - 1) // step
    if train <= k:
        r = c
    else:
        l = c
print(r)


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)
costs = [(ai * fi, fi) for ai, fi in zip(a, f)]
costs.sort(reverse=True)
# l impossible, r ok
l, r = -1, costs[0][0]
while(r - l > 1):
    c = (l + r) // 2
    train = 0
    for cost, step in costs:
        if cost > c:
            train += (cost - c + step - 1) // step
    if train <= k:
        r = c
    else:
        l = c
print(r)
### BUGGY CODE ###


n = int(input())

xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
zs = list(map(int, input().split()))

bs = [0] * n
for i in range(n):
    bs[i] = sum(map(lambda x:  1 if x < ys[i] else 0,  xs))


cs = [0] * n
for i in range(n):
    cs[i] = sum(map(lambda y:  bs[y[0]]  if y[1] < zs[i] else 0,  enumerate(ys)))

print(sum(cs))


### FIXED CODE ###


n = int(input())

xs = sorted(map(int, input().split()))
ys = sorted(map(int, input().split()))
zs = sorted(map(int, input().split()))

bs = [0] * n
j = 0
for i in range(n):
    while j < n and xs[j] < ys[i]:
        j += 1
    bs[i] = j

cs = [0] * n
j = 0
k = 0
for i in range(n):
    while j < n and ys[j] < zs[i]:
        k += bs[j]
        j += 1
    cs[i] = k

print(sum(cs))
### BUGGY CODE ###

import copy
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
B = copy.deepcopy(A)

for k in range(N):
    for i in range(N):
        for j in range(N):
            if A[i][k] + A[k][j] < A[i][j]:
                A[i][j] = A[i][k] + A[k][j]

flag = True
for i in range(N):
    for j in range(N):
        if A[i][j] != B[i][j]:
            flag = False
            break
    if not flag:
        break

if not flag:
    print(-1)
    exit()


for i in range(N):
    for j in range(N):
        for k in range(N):
            if i == k or j == k:
                continue
            if A[i][k] + A[k][j] == A[i][j]:
                B[i][j] = 0
print(sum(map(sum, B))//2)


### FIXED CODE ###

import copy
N = int(input())
A = [list(map(int, input().split())) for _ in range(N)]
B = copy.deepcopy(A)

for k in range(N):
    for i in range(N):
        for j in range(N):
            if A[i][k] + A[k][j] < A[i][j]:
                A[i][j] = A[i][k] + A[k][j]

flag = True
for i in range(N):
    for j in range(N):
        if A[i][j] != B[i][j]:
            flag = False
            break
    if not flag:
        break

if not flag:
    print(-1)
    exit()


for i in range(N):
    for j in range(N):
        for k in range(N):
            if i == k or j == k:
                continue
            if A[i][k] + A[k][j] == A[i][j]:
                B[i][j] = 0
print(sum(map(sum, B))//2)
### BUGGY CODE ###

import sys
import bisect
import heapq
sys.setrecursionlimit(10 ** 7)

# TLE

N, Q = map(int, input().split())
STX = [[int(x) for x in input().split()] for _ in range(N)]
EVENT = []
for s, t, x in STX:
    EVENT.append((s-x, 1, x))
    EVENT.append((t-x, 0, x))

for i in range(Q):
    d = int(input())
    EVENT.append((d, 2, i))

ans = [-1] * Q

EVENT.sort()

# print(EVENT)

STOP = set()
for t, op, x in EVENT:
    if op == 2 and STOP:
        ans[x] = min(list(STOP))
    elif op == 1:
        #heapq.heappush(STOP, x)
        STOP.add(x)
    elif op == 0:
        if x in STOP:
            STOP.remove(x)
        # heapq.heapify(STOP)


print("\n".join(map(str, ans)))


### FIXED CODE ###

#D in [S_i-X_i,T_i-X_i) → Xiで止まる
import sys
input = sys.stdin.readline
from heapq import heappop,heappush
from collections import defaultdict

N,Q = map(int,input().split())
task = []

STX = [[int(x) for x in input().split()] for _ in range(N)]
for s,t,x in STX:
  task.append((t-x,0,x)) # xで止まらなくなる
  task.append((s-x,1,x)) # xで止まる

for i in range(Q):
  d = int(input())
  task.append((d,2,i)) # 止まる位置を答える
answer = [-1]*Q

task.sort()

# 引っかかってる場所の管理
se = set()
se_hp = [] # heapで最小値を先頭に保つ

# 小さい時刻から順に見ていく
for a,b,c in task:
  if not b: # b == 0
    se.remove(c)
  elif b&1: # b == 1
    se.add(c)
    heappush(se_hp,c)
  else: # b == 2
    while se_hp and se_hp[0] not in se:
      heappop(se_hp)
    answer[c] = se_hp[0] if se_hp else -1

print('\n'.join(map(str,answer)))
### BUGGY CODE ###

import sys

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

### FIXED CODE ###

import bisect
N=int(input())
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))
ans=0
for i in B:
  a=bisect.bisect_left(A,i)
  b=N-bisect.bisect_right(C,i)
  ans+=a*b
print(ans)
### BUGGY CODE ###

N , M = map(int,input().split())
A_B = []
for i in range(N):
	A_B.append(list(map(int,input().split())))
A = []
B = []
for i in range(N):
	A.append(A_B[i][0])
	B.append(A_B[i][1])

money = 0	
while M > 0:
	min_price = min(A)
	min_price_amount = B[A.index(min_price)]
	if M >= min_price_amount:
		M -= min_price_amount
		money += min_price * min_price_amount
		del A[A.index(min_price)]
		del B[B.index(min_price_amount)]
	else:
		money += min_price * M
		M = 0
		
print(money)

### FIXED CODE ###

import numpy as np
N , M = map(int,input().split())
A_B = []
for i in range(N):
	A_B.append(list(map(int,input().split())))
A_B = np.array(A_B).T

arg_A_B = np.argsort(A_B[0])

sort_A_B = A_B[:,arg_A_B]

money = 0
i = 0
while M > 0:
	money += sort_A_B[0][i] * sort_A_B[1][i]
	M -= sort_A_B[1][i]
	i += 1
print(money + M * sort_A_B[0][i - 1])
### BUGGY CODE ###

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

gap = M - N
if gap >= 2:
	ans = 0
else:
	ans = 1
	for i in range(1, M+1):
		ans *= i
	for i in range(1, N+1): 
		ans *= i
	if gap == 0:
		ans *= 2
print(ans%(10**9+7))

### FIXED CODE ###

from math import factorial as f
N, M = sorted(list(map(int, input().split())))

gap = M - N
if gap >= 2:
	ans = 0
else:
	ans = f(M) * f(N)
	if gap == 0:
		ans *= 2
print(ans%(10**9+7))
### BUGGY CODE ###

from itertools import groupby, accumulate, product, permutations, combinations
def solve():
  N = int(input())
  A = [list(map(int, input().split())) for _ in range(N)]
  dp = [0]*(1<<N)
  dp[0] = 0
  for i in range(2,N+1):
    for com in combinations(range(N),i):
      S = 0
      for c in com:
        S += 1<<c
      last = com[-1]
      dp[S] = dp[S-(1<<last)]
      for c in com:
        dp[S] += A[last][c]
  for i in range(2,N+1):
    for com in combinations(range(N),i):
      S = 0
      for c in com:
        S += 1<<c
      for p in product([0,1],repeat=i-1):
        s = 0
        for j in range(i-1):
          if p[j]==1:
            s += 1<<com[j]
        dp[S] = max(dp[S],dp[s]+dp[S-s])
  ans = dp[-1]
  return ans
print(solve())

### FIXED CODE ###

from itertools import groupby, accumulate, product, permutations, combinations
def solve():
  N = int(input())
  A = [list(map(int, input().split())) for _ in range(N)]
  dp = [0]*(1<<N)
  dp[0] = 0
  for i in range(2,N+1):
    for com in combinations(range(N),i):
      S = sum([1<<c for c in com])
      last = com[-1]
      dp[S] = dp[S-(1<<last)]
      for c in com:
        dp[S] += A[last][c]
  for i in range(2,N+1):
    for com in combinations(range(N),i):
      S = sum([1<<c for c in com])
      T = (S-1)&S
      while T>0:
        dp[S] = max(dp[S],dp[T]+dp[S-T])
        T = (T-1)&S
  ans = dp[-1]
  return ans
print(solve())
### BUGGY CODE ###

s = list(input())
t = list(input())
#s = ['a','b','a']
#t = ['d','e','f']

arr = [[s[i],t[i]] for i in range(len(s))]

ans = 'Yes'

for y in arr:
	for j in range(len(s)):
		if y[0] == arr[j][0] and y[1] != arr[j][1]:
			ans = 'No'
		elif y[1] == arr[j][1] and y[0] != arr[j][0]:
			ans = 'No'


print(ans)
	
	




### FIXED CODE ###

s = input()
t = input()

counta={}
countb={}

for i in s:
    if i in counta:
        counta[i] += 1
    else:
        counta[i] = 1

for y in t:
    if y in countb:
        countb[y] += 1
    else:
        countb[y] = 1

if sorted(counta.values())  == sorted(countb.values()):
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    def bit(n):
        b = []
        i = 1
        while i < n:
            i *= 2

        while n:
            if n >= i:
                n -= i
                b.append(i)

            i //= 2
            if i == 0:
                i = 1
        return b

    B = []
    for a in A:
        B.append(bit(a))

    # print('---')
    ans = N
    for i in range(N):
        # print(i)
        S = set(B[i])
        s = len(B[i])
        for j in range(i + 1, N):
            S |= set(B[j])
            s += len(B[j])
            if len(S) != s:
                break
            else:
                ans += 1
        # ans += (j - i) + 1

        # print(B)
    return ans


def main():
    N = read_int()
    A = read_int_n()
    # N = 2 * 100000
    # A = [0] * N
    print(slv(N, A))


if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
import time
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    ans = 0
    S = 0
    X = 0
    r = 0
    for l in range(N):
        while r != N and S + A[r] == X ^ A[r]:
            S += A[r]
            X ^= A[r]
            r += 1
        ans += r - l
        S -= A[l]
        X ^= A[l]

    return ans


def main():
    N = read_int()
    A = read_int_n()

    print(slv(N, A))


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

n=int(input())
il=list(map(int, input().split()))
yn="Yes"
l=len(il)
for i in range(1, l):
    if i == 0:
        continue
    for j in range(0,i-1):
        if il[j] > il[i] + 1:
            yn = "No"
            break
print(yn)

### FIXED CODE ###

n=int(input())
il=list(map(int, input().split()))
m=il[0]
yn="Yes"
for a in il[1:]:
    if m - 1 <= a:
        m=max([m, a])
        continue
    yn="No"
    break
print(yn)
### BUGGY CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
visited=[]
x=0
now=1
next_point=a[now-1]
for cnt in range(k):
    now=next_point
    next_point=a[now-1]
    if now in visited:
        x=visited.index(now)
        break
    else:
        visited.append(now)
new_visited=visited[x:]
k-=len(visited)-len(new_visited)

#print(visited)
#print(new_visited)
print(new_visited[k%len(new_visited)-1])

### FIXED CODE ###

N,K=map(int,input().split())
A=[int(a)-1 for a in input().split()]
city=0
if K<=N:
    for k in range(K):
        city=A[city]
    print(city+1)
else:
    visited=[-1]*N
    for k in range(K):
        if visited[city]!=-1:
            roop_start=visited[city]
            cycle_num=k-roop_start
            break
        visited[city]=k
        city=A[city]
    K=(K-roop_start)%cycle_num+roop_start
    city=0
    for k in range(K):
        city=A[city]
    print(city+1)
### BUGGY CODE ###

s = input()
k = int(input())
substrings = set()
for i in range(len(s)):
    for j in range(len(s), 0, -1):
        if j - i <= 0:
            continue
        substrings.add(s[i:j])
s_list = list(substrings)
s_list.sort()
print(s_list[k-1])


### FIXED CODE ###

s = input()
k = int(input())
substrings = set()
s_list = []
for i in range(len(s)):
    for j in range(i+1, i+6):
        substrings.add(s[i:j])
s_list = list(substrings)
s_list.sort()
print(s_list[k-1])
### BUGGY CODE ###

numMultiples=0
S=input()
N=len(S)
seenRemainders=[set()]*(N+1)
for i in range(N):
    remainder = 0
    prefixesFound = 0
    for j in range(i,N):
        remainder = (10 * remainder + int (S[j]) ) % 2019
        if remainder in seenRemainders[j]:
            break
            seenRemainders[j].add(remainder)
        if remainder == 0:
            prefixesFound+=1
    numMultiples += prefixesFound * (prefixesFound + 1) / 2
print(int(numMultiples))


### FIXED CODE ###

S=input()[::-1]
l=len(S)
t=0
p=0
 
ss=[0]*2019
ss[0]=1
d=1
for i in S:
    p=(p+int(i)*d)%2019
    d*=10
    d%=2019
    ss[p]+=1
 
for c in ss:
    t+=c*(c-1)//2
print(t)
### BUGGY CODE ###

n,x,y=map(int,input().split())
l=[]
r_append = l.append
for i in range(n-1):
  for k in range (i+1,n):
    if k<(x+y)//2-1 or i>(x+y)//2:
      r_append(k-i)
    else:
      r_append(min(abs(x-1-i)+abs(y-1-k)+1,k-i))
for i in range(1,n):
  print(l.count(i))

### FIXED CODE ###

from collections import Counter
n,x,y=map(int,input().split())
l=[]
for i in range(n-1):
  for k in range (i+1,n):
      l.append(min(abs(x-1-i)+abs(y-1-k)+1,k-i))
S=Counter(l)
for i in range(1,n):
  print(S[i])
### BUGGY CODE ###

n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))
for i in range(m):
    if d.count(t[i])>0:
        d.remove(t[i])
    else:
        print("NO")
        exit()
print("YES")

### FIXED CODE ###

n = int(input())
d = list(map(int,input().split()))
m = int(input())
t = list(map(int,input().split()))
d.sort()
t.sort()
i=0
j=0
while i<m and j<n:
    if t[i]==d[j]:
        i+=1
        j+=1
    elif t[i]<d[j]:
        print("NO")
        exit()
    else:
        j+=1
print("YES")
### BUGGY CODE ###

from collections import defaultdict
N = int(input())
a = list(map(int, input().split()))
pow2 = [1]
for i in range(61):
    pow2.append(pow2[-1] * 2)
a = sorted(a, reverse=True)
d = defaultdict(int)
for i in a:
    d[i] += 1


num = 0
for i in range(N):
    for k in range(60, -1, -1):
        if pow2[k] - a[i] != a[i]:
            if d[pow2[k] - a[i]] > 0 and d[a[i]] > 0:
                num += 1
                d[pow2[k] - a[i]] -= 1
                d[a[i]] -= 1
                break
        else:
            if d[a[i]] >= 2:
                num += 1
                d[a[i]] -= 2
                break
print(num)

### FIXED CODE ###

from collections import defaultdict
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
pow2 = [1]
for i in range(31):
    pow2.append(pow2[-1] * 2)
a = sorted(a, reverse=True)
d = defaultdict(int)
for i in a:
    d[i] += 1


num = 0
for i in range(N):
    if d[a[i]] == 0:
        continue
    for k in range(30, -1, -1):
        inv = pow2[k] - a[i]
        if inv < 0 or inv > a[i]:
            continue
        if inv != a[i]:
            if d[inv] > 0 and d[a[i]] > 0:
                p = min(d[inv], d[a[i]])
                num += p
                d[inv] -= p
                d[a[i]] -= p
                break
        else:
            if d[a[i]] >= 2:
                num += d[a[i]] // 2
                d[a[i]] %= 2
                break
print(num)
### BUGGY CODE ###

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

ans = 0
a = 0
for b in range(N):
    if all(s[(i - a) % N][(j - b) % N] == s[(j - a) % N][(i - b) % N] for i in range(N) for j in range(i + 1, N)):
        ans += N
print(ans)


### FIXED CODE ###

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

ans = 0
a = 0
for b in range(N):
    if all(s[(i - a) % N][(j - b) % N] == s[(j - a) % N][(i - b) % N] for i in range(N) for j in range(i + 1, N)):
        ans += N
print(ans)
### BUGGY CODE ###

n=int(input())
d=[[] for i in range(n)]
s=[]
count=0
for i in range(n):
  s=input()
  for j in range(10):
    d[i].append(s[j])
  d[i].sort()
for i in range(n):
  for j in range(n):
    if i!=j and d[i]==d[j]:
      count+=1
print(int(count/2))

### FIXED CODE ###

n=int(input())
d=[list(input()) for i in range(n)]
count=0
ans=0
for i in range(n):
  d[i].sort()
d.sort()

for i in range(n-1):
  if d[i]==d[i+1]:
    count+=1
  elif d[i]!=d[i+1]:
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  if i==(n-2):
    x=count+1
    count=0
    ans+=(x*(x-1))/2
  
print(int(ans))
### BUGGY CODE ###

import itertools
n=int(input())
L=list(map(int,input().split()))

L.sort()
c=(list(itertools.combinations(L,3)))
ans=0
for a,b,c in c:
  if b-a<c and c<a+b:
    ans+=1
print(ans)

### FIXED CODE ###

import bisect
n=int(input())
L=list(map(int,input().split()))

L.sort()
ans=0
for i in range(n):
  for j in range(i+1,n):
    index=bisect.bisect_left(L,L[i]+L[j])
    ans+=index-(j+1)
    
print(ans)
### BUGGY CODE ###

N, K = map(int,input().split())
R, S, P = map(int,input().split())
T = input()
 
def MaxScore(rsp, s):
    Score = 0
    t = list(s)
    t = t + ['t']
    for i in range(len(t)-1):
        if t[i] == t[i+1]:
            t[i+1] = 'x' + t[i+1]
    for i in range(len(t)):
        if t[i] == 'r':
            Score = Score + rsp[2]
        elif t[i] == 's':
            Score = Score + rsp[0]
        elif t[i] == 'p':
            Score = Score + rsp[1]
    return Score
 
def strsplit(n, t, k):
    tList = [""] * k
    for i in range(n):
        tList[i % k] = tList[i % k] + t[i]
    return tList
 
RSP = [R, S, P]
Answer = 0
for i in range(K):
    Answer = MaxScore(RSP, strsplit(N, T, K)[i]) + Answer
 
print(Answer)

### FIXED CODE ###

N, K = map(int,input().split())
R, S, P = map(int,input().split())
T = input()
 
def EarnScore(rsp, t):
    if t == 'r':
        return rsp[2]
    elif t == 's':
        return rsp[0]
    elif t == 'p':
        return rsp[1]
    else:
        return 0
 
RSP = [R, S, P]
Answer = 0
ListT = list(T)
for i in range(N):
    Answer = EarnScore(RSP, ListT[i]) + Answer
    if i + K < N:
        if ListT[i] == ListT[i+K]:
            ListT[i+K] = 'x'
 
print(Answer)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

n,k,q = map(int, input().split())
a = [int(input()) for _ in range(q)]
#print(a)

pts = [k for _ in range(n)]

for i in range(q):
    for j in range(n):
        if j != a[i]-1:
            pts[j] -= 1
        else:
            pass
#print(pts)

for i in range(n):
    if pts[i] > 0:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

# -*- coding: utf-8 -*-

n, k, q = map(int, input().split())


li = [0]*n
for i in range(q):
    a = int(input())
    li[a-1] += 1

for i in range(n):
    if li[i] > q-k:
        print("Yes")
    else:
        print("No")