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

import sys
import numpy as np
n,k,q=map(int,input().split())
list=[]
for i in range(q):
    list.append(int(input()))

point = np.zeros(n+1)
for i in range(len(point)):
    point[i] = k

for i in range(len(list)):
    for j in range(len(point)):
        if j != list[i]:
            point[j] -= 1

for i in range(1,len(point),1):
    if point[i] > 0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

import sys
import numpy as np
n,k,q=map(int,input().split())
list=[]
for i in range(q):
    list.append(int(input()))

point = [k] * n
for i in range(len(list)):
    point[list[i]-1] += 1

for i in range(len(point)):
    if point[i] > q:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

def mini(N, K):
    return abs(N-K)


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

while True:
    n = abs(N-K)
    if n >= N:
        print(N)
        break
    N = n


### FIXED CODE ###

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

s = N % K

print(min(s, K-s))
### BUGGY CODE ###

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

A = [int(i) for i in input().split()]

L = []
for i in range(m):
    b,c = map(int, input().split())
    L.append((b,c))
    
A = sorted(A)

from bisect import bisect_left
import numpy as np
A = np.array(A)
for l in L:
    tmp0 = l[0]
    tmp1 = l[1]
    A_len = bisect_left(A, tmp1)
    A = np.insert(A, A_len, [tmp1 for i in range(tmp0)])[tmp0:]
    
print(sum(A))

### FIXED CODE ###

N, M = map(int, input().split())
A = [int(i) for i in input().split()]

D = {}
for i in range(M):
    b,c = map(int, input().split())
    if c in D:
        D[c] += b
    else:
        D[c] = b
        
for a in A:
    if a in D:
        D[a] += 1
    else:
        D[a] = 1
        
D_sort = sorted(D.items(), reverse=True)
check = 0
ans = 0
for d in D_sort:
    check += d[1]
    if check <= N:
        ans += d[0] * d[1]
    else:
        ans += d[0] * (d[1] - (check - N))
        break
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python
from collections import defaultdict, deque
import math
from math import factorial
import fractions
import re

BIGNUM = 10 ** 9 + 7

def main():
    #A, B, C = map(int, input().split())
    #N = int(input())
    #Hs = list(map(int, input().split()))

    S = input().strip()
    result = [0] * len(S)

    nearest_R = -1
    nearest_L = len(S) + 1
    for i in range(len(S)):
        if S[i] == 'R':
            if nearest_R > i:
                j = nearest_R
            else:
                for j in range(i+1, len(S)):
                    if S[j] == 'L':
                        break
            dist = j - i
            if dist % 2 == 0:
                result[j] += 1
            else:
                result[j-1] += 1
        else:
            # S[i] == 'L'
            if nearest_L < i:
                j = nearest_L
            else:
                for k in range(1, i+1):
                    j = i - k
                    if S[j] == 'R':
                        break
            dist = i - j
            if dist % 2 == 0:
                result[j] += 1
            else:
                result[j+1] += 1

    print(' '.join(map(str, result)))


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python
from collections import defaultdict, deque
import math
from math import factorial
import fractions
import re
import bisect

BIGNUM = 10 ** 9 + 7

def main():
    #A, B, C = map(int, input().split())
    #N = int(input())
    #Hs = list(map(int, input().split()))

    S = input().strip()
    result = [0] * len(S)

    L_list, R_list = {}, {}
    prev_L, prev_R = [], []
    for i in range(len(S)):
        if S[i] == 'L':
            for j in prev_L:
                L_list[j] = i
            prev_L = []
        else:
            prev_L.append(i)
    for i in range(len(S)):
        i = len(S) - 1 - i
        if S[i] == 'R':
            for j in prev_R:
                R_list[j] = i
            prev_R = []
        else:
            prev_R.append(i)

    for i in range(len(S)):
        if S[i] == 'R':
            j = L_list[i]
            dist = j - i
            if dist % 2 == 0:
                result[j] += 1
            else:
                result[j-1] += 1
        else:
            # S[i] == 'L'
            j = R_list[i]
            dist = i - j
            if dist % 2 == 0:
                result[j] += 1
            else:
                result[j+1] += 1

    print(' '.join(map(str, result)))


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

# -*- coding: utf-8 -*-
s = str(input())
q = int(input())
l = []
for i in range(q):
  qy = input().split()
  l.append(qy)
  
st = s
count = 0
for i in range(q):
  k = l[i][0]
  if(k == '1'):
    count += 1
  elif(k == '2'):
    c = count
    d = int(l[i][1])
    e = l[i][2]
    if((c + d) % 2 == 1):
      st = e + st
    elif((c + d) % 2 == 0):
      st = st + e

if(count % 2 == 1):
  st = st[::-1]
      
print(st)

### FIXED CODE ###

# -*- coding: utf-8 -*-
s = str(input())
q = int(input())  
st = s
sth = s
sth2 = ""
stm = ""
stm2 = ""
count = 0
flagh = 0
flagm = 0
for i in range(q):
  k = input().split()
  if(k[0] == '1'):
    count = (count + 1) % 2
  else:
    c = count - 2
    d = int(k[1]) 
    e = k[2]
    if(c + d != 0):
      sth = e + sth
      if(len(sth) > 5000 and flagh == 0):
        flagh = 1
        sth2 = sth
        sth = ""
    else:
      stm = stm + e
      if(len(stm) > 5000 and flagm == 0):
        flagm = 1
        stm2 = stm
        stm = ""
      

st = sth + sth2 + stm2 + stm
if(count == 1):
  st = st[::-1]
  
print(st)
### BUGGY CODE ###

N,K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
before = 1
for i in range(K):
    before *= A[i]
val = 0
for i in range(K,len(A)):
    val = before
    val = val / A[i-K] * A[i]

    if(val > before):
        print("Yes")
    else:
        print("No")
    before = val

### FIXED CODE ###

N,K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

for i in range(K,N):
    if(A[i-K] < A[i]):
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

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

ans = 0
for i in range(N):
    Pi = P[i]
    flag = True
    for j in range(i+1):
        Pj = P[j]
        if not(Pi <= Pj):
            flag = False
    if flag:
        ans += 1
print(ans)


### FIXED CODE ###

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

m = P[0]
ans = 0
for i in range(N):
    # print(P[:i+1])
    if P[i] <= m:
        m = P[i]
        # print(i)
        ans += 1
    # m = max(P[:i+1])
    # print(m)


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

# これもdeque使わないと時間切れになるのか？
from sys import stdin


class Node():
    def __init__(self,  key=None, prev=None, next=None):
        self.key = key
        self.prev = prev
        self.next = next


class DoublyLinkedList():
    def __init__(self):
        self.head = Node()
        self.head.next = self.head
        self.head.prev = self.head

    def insert(self, x):
        node = Node(key=x, prev=self.head, next=self.head.next)
        self.head.next.prev = node
        self.head.next = node

    def delete(self, x):
        node = self.head.next
        while node is not self.head and node.key != x:
            node = node.next
        if node != self.head:
            node.prev.next = node.next
            node.next.prev = node.prev

    def deleteFirst(self):
        self.head.next.next.prev = self.head
        self.head.next = self.head.next.next

    def deleteLast(self):
        self.head.prev.prev.next = self.head
        self.head.prev = self.head.prev.prev

    def getKeys(self):
        node = self.head.next
        keys = []
        while node is not self.head:
            keys.append(str(node.key))
            node = node.next
        return " ".join(keys)


L = DoublyLinkedList()
n = int(input())
for i in range(n):
    command = stdin.readline().strip().split()
    if command[0] == "insert":
        L.insert(int(command[1]))
    elif command[0] == "delete":
        L.delete(int(command[1]))
    elif command[0] == "deleteFirst":
        L.deleteFirst()
    else:
        L.deleteLast()

print(L.getKeys())



### FIXED CODE ###

import sys


class Node():
    def __init__(self,  key=None, prev=None, next=None):
        self.key = key
        self.prev = prev
        self.next = next


class DoublyLinkedList():
    def __init__(self):
        self.head = Node()
        self.head.next = self.head
        self.head.prev = self.head

    def insert(self, x):
        node = Node(key=x, prev=self.head, next=self.head.next)
        self.head.next.prev = node
        self.head.next = node

    def search(self, x):
        node = self.head.next
        while node is not self.head and node.key != x:
            node = node.next
        return node

    def delete_key(self, x):
        node = self.search(x)
        if node is self.head:
            return None
        self._delete(node)

    def _delete(self, node):
        node.prev.next = node.next
        node.next.prev = node.prev

    def deleteFirst(self):
        self._delete(self.head.next)

    def deleteLast(self):
        self._delete(self.head.prev)

    def getKeys(self):
        node = self.head.next
        keys = []
        while node is not self.head:
            keys.append(node.key)
            node = node.next
        return " ".join(keys)


L = DoublyLinkedList()
n = int(input())
for i in sys.stdin:
    if 'insert' in i:
        x = i[7:-1]
        L.insert(x)
    elif 'deleteFirst' in i:
        L.deleteFirst()
    elif 'deleteLast' in i:
        L.deleteLast()
    elif 'delete' in i:
        x = i[7:-1]
        L.delete_key(x)
    else:
        pass
print(L.getKeys())
### BUGGY CODE ###

def solve(l,r):
    p = 0
    is_prime =[True for i in range(r+1)]
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,r+1):
        if is_prime[i]:
            p += 1
            for j in range(i+i,r,i):
                is_prime[j] = False
    c = [0 for i in range(r+1)]
    for i in range(3,r+1,2):
        if is_prime[i] and is_prime[(i+1)//2]:
            c[i] = c[i-2] + 1
        else:
            c[i] = c[i-2]
    if l != 1:
        res = c[r] - c[l-2]
    else:
        res = c[r] - c[l]
    return res

if __name__ == '__main__':
    q = int(input())
    for i in range(q):
        l,r = map(int,input().split())
        print(solve(l,r))

### FIXED CODE ###

def sieve(n):
    is_prime =[True for i in range(n+1)]
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,int(n**0.5)+1):
        if is_prime[i]:
            for j in range(i+i,n,i):
                is_prime[j] = False
    c = [0 for i in range(n+1)]
    for i in range(3,n+1,2):
        if is_prime[i] and is_prime[(i+1)//2]:
            c[i] = 1
    for i in range(n):
        c[i+1] += c[i]
    return c

def solve(l,r,c):
    return c[r]-c[l-1]



if __name__ == '__main__':
    q = int(input())
    c = sieve(100000)
    for i in range(q):
        l,r = map(int,input().split())
        print(solve(l,r,c))
### BUGGY CODE ###

N,M = map(int, raw_input().split())
A = list(map(int,raw_input().split()))	
A=sorted(A)
ans = 0
for i in range(0,M):
  max_A = A[N-1]
  max_A = max_A / 2
  A[N-1] = max_A
  A = sorted(A)
for i in A:
  ans = ans+i
  
print ans

### FIXED CODE ###

import heapq

N,M = map(int, raw_input().split())
A = list(map(lambda x: int(x)*(-1), raw_input().split()))

heapq.heapify(A)

for i in range(0,M):
  max_A = heapq.heappop(A)*(-1) / 2*(-1)
  heapq.heappush(A,max_A)

print sum(A)*(-1)
### BUGGY CODE ###

A,B = map(int,input().split())
tmp=0
cnt=0

while tmp<3:
  if A > B:
    cnt+=A
    A-=1
    tmp+1
  elif A < B:
    cnt+=B
    B-=1
    tmp+1
  else:
    cnt+=A
    A-=1
    tmp+1
print(cnt)
  


### FIXED CODE ###

A,B = map(int,input().split())
tmp=0
cnt=0

while tmp<2:
  if A > B:
    cnt+=A
    A-=1
    tmp+=1
  elif A < B:
    cnt+=B
    B-=1
    tmp+=1
  else:
    cnt+=A
    A-=1
    tmp+=1
print(cnt)
### BUGGY CODE ###

#ABC177E
N = int(input())
#N = 1000000
A = list(map(int, input().split()))
#A = [i+1 for i in range(1000000)]
p = {2*i+1: 1 for i in range(1, 500)}
for i in range(3, 1000, 2):
  for j in p:
    if j != i:
      if j % i == 0:
        p[j] = 0
L = [2]
for i in p:
  if p[i] == 1:
    L.append(i)
def gcd(x, y):
  k, l = x, y
  while l:
    k, l = l, k % l
  return k
g = A[0]
i = 0
nn = len(L)
while i < N:
  g = gcd(g, A[i])
  if g == 1:
    break
  i += 1
if g > 1:
  print("not coprime")
else:
  D = {}
  m = 0
  for i in A:
    pnt = 0
    x = i
    for j in L:
      cnt = False
      while x % j == 0:
        cnt = True
        x //= j
      if cnt:
        if j in D:
          D[j] += 1
          if D[j] == 2:
            m = 2
            break
        else:
          D[j] = 1
      pnt += 1
      if pnt == nn and x != 1:
        if x in D:
          D[x] += 1
          if D[x] == 2:
            m = 2
        else:
          D[x] = 1
        break
      if x == 1:
        break
    if m >= 2:
      break
  if D == {}:
    print("pairwise coprime")
  else:
    if m > 1:
      print("setwise coprime")
    else:
      print("pairwise coprime")


### FIXED CODE ###

#ABC177E
N = int(input())
#N = 1000000
A = list(map(int, input().split()))
#A = [i+1 for i in range(1000000)]
p = {2*i+1: 1 for i in range(1, 500)}
for i in range(3, 1000, 2):
  for j in p:
    if j != i:
      if j % i == 0:
        p[j] = 0
L = [2]
for i in p:
  if p[i] == 1:
    L.append(i)
def gcd(x, y):
  k, l = x, y
  while l:
    k, l = l, k % l
  return k
g = A[0]
i = 0
nn = len(L)
while i < N:
  g = gcd(g, A[i])
  if g == 1:
    break
  i += 1
if g > 1:
  print("not coprime")
else:
  D = {}
  m = 0
  for i in A:
    pnt = 0
    x = i
    for j in L:
      cnt = False
      while x % j == 0:
        cnt = True
        x //= j
      if cnt:
        if j in D:
          D[j] += 1
          if D[j] == 2:
            m = 2
            break
        else:
          D[j] = 1
      pnt += 1
      if pnt == nn and x != 1:
        if x in D:
          D[x] += 1
          if D[x] == 2:
            m = 2
        else:
          D[x] = 1
        break
      if x == 1:
        break
    if m >= 2:
      break
  if D == {}:
    print("pairwise coprime")
  else:
    if m > 1:
      print("setwise coprime")
    else:
      print("pairwise coprime")
### BUGGY CODE ###

import bisect
n,m=map(int, input().split())
l={}
for i in range(n):
    a,b=map(int, input().split())
    if not a in l:
        l[a]=[b]
    else:
        l[a].append(b)

res=0
target=[]
for i in range(1,m+1):
    if i in l:
        for j in l[i]:
            bisect.insort_left(target, j)

    if not target:
        val=0
    else:
        val=target.pop()
    res+=val
    #print(target, max(target))

print(res)


### FIXED CODE ###

import bisect
import array

n,m=map(int, input().split())
l={}
for i in range(n):
    a,b=map(int, input().split())
    if not a in l:
        l[a]=[b]
    else:
        l[a].append(b)

res=0
target=array.array('I', [])
for i in range(1,m+1):
    if i in l:
        for j in l[i]:
            bisect.insort_left(target, j)

    if not target:
        val=0
    else:
        val=target.pop()
    res+=val
    #print(target, max(target))

print(res)
### BUGGY CODE ###

import numpy
import bisect
N,Q = (int(x) for x in input().split())

stop_arr = []
for _ in range(N):
    S,T,X = (int(x) for x in input().split())
    stop_arr.append((S,T,X))
Q_arr = []
for _ in range(Q):
    Q_arr.append(int(input()))

stop_arr.sort(key=lambda x:x[2], reverse=True)

Q_arr = numpy.array(Q_arr)
ans_arr = numpy.array([-1]*Q)

for s,t,x in stop_arr:
    q_start = numpy.searchsorted(Q_arr, s-x)
    q_stop = numpy.searchsorted(Q_arr, t-x)
    ans_arr[q_start:q_stop] = x

for a in ans_arr:
    print(a)


### FIXED CODE ###

import bisect

N,Q = (int(x) for x in input().split())

stop_arr = [tuple(map(int, input().split())) for _ in range(N)]
Q_arr = [int(input()) for _ in range(Q)]

stop_arr_ind = list(range(N))
stop_arr_ind.sort(key=lambda x:stop_arr[x][2])
# stop_arr.sort(key=lambda x:x[2], reverse=True)
ans_arr = [-1]*Q
skip_arr = [-1]*(Q+1)

def update_skip(skip_arr, x):
    if skip_arr[x] == -1:
        return x
    x_dest = update_skip(skip_arr, skip_arr[x])
    skip_arr[x] = x_dest
    return x_dest

for i in stop_arr_ind:
    s,t,x = stop_arr[i]
    q_start = bisect.bisect_left(Q_arr, s-x)
    q_stop = bisect.bisect_left(Q_arr, t-x)
    l = q_start
    while l < q_stop:
        if skip_arr[l] == -1:
            skip_arr[l] = q_stop
            ans_arr[l] = x
            l += 1
        else:
            l = update_skip(skip_arr, l)

print(*ans_arr, sep="\n")
### BUGGY CODE ###

from itertools import combinations

def main():
    N = int(input())
    L = list(map(int, input().split()))

    L = sorted(L)
    ans = 0
    comb = [p for p in combinations(L, 3)]
    for a, b, c in comb:
        if c < a + b:
            ans += 1

    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

from bisect import bisect_left

def main():
    N = int(input())
    L = list(map(int, input().split()))
    
    L = sorted(L)
    ans = 0
    for i in range(N-2):
        a = L[i]
        for j in range(i+1, N-1):
            k = bisect_left(L[j+1:], a + L[j])
            ans += k

    print(ans)

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

import sys
input = sys.stdin.buffer.readline

N,Q = map(int, input().split())
List = []
dic = {}
for _ in range(N):
    s, t, x = map(int, input().split())
    List.append([s-0.5-x, 1, x])
    List.append([t-0.5-x, -1, x])
    dic[x] = False

import heapq
    
List.sort()

h = []
j = 0
for _ in range(Q):
    D = int(input())
    while j < 2*N and List[j][0] < D:
        if List[j][1] == 1:
            heapq.heappush(h, List[j][2])
            dic[List[j][2]] = True
        else:
            dic[List[j][2]] = False
        j += 1
    while h:
        ans = h[0]
        if dic[ans]:
            print(ans)
            break
        else:
            heapq.heappop(h)
    if not h:
        print(-1)

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline

N,Q = map(int, input().split())
List = []
dic = {}
for _ in range(N):
    s, t, x = map(int, input().split())
    List.append((s-0.5-x, 1, x))
    List.append((t-0.5-x, -1, x))
    dic[x] = False

import heapq
    
List.sort()

h = []
j = 0
for _ in range(Q):
    D = int(input())
    while j < 2*N and List[j][0] < D:
        if List[j][1] == 1:
            heapq.heappush(h, List[j][2])
            dic[List[j][2]] = True
        else:
            dic[List[j][2]] = False
        j += 1
    while h:
        ans = h[0]
        if dic[ans]:
            print(ans)
            break
        else:
            heapq.heappop(h)
    if not h:
        print(-1)
### BUGGY CODE ###

from sys import stdin

ans = []
temp_array = []
temp_ans = []


def problem_a(input_string):
    S = int(input_string[0].rstrip())
    N = input_string[1].rstrip()
    N_l = len(N)
    global temp_ans
    global ans
    global temp_array
    for i in range(N_l)[::-1]:
        ans += N[i]
        if i == N_l-1:
            temp_ans = ans
        else:
            for s in temp_ans:
                if s[0] != N[i] and N[i] not in s:
                    temp_ans.append(N[i]+s)
                    #print(N[i]+s)
        #print(temp_ans)
        ans += temp_array
        temp_ans = ans
        temp_array = []
    return len(ans) % (10**9 + 7)


def main():
    input_line = stdin.readlines()
    answer = problem_a(input_line)
    print(answer)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from sys import stdin
import math
import itertools


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# これだと、O(n*n)
"""
temp_ans = []


def problem_a(input_string):
    S = int(input_string[0].rstrip())
    N = input_string[1].rstrip()
    N_l = len(N)
    global temp_ans
    for i in range(N_l)[::-1]:
        temp_ans += N[i]
        #print(temp_ans)
        for s in temp_ans:
            #print(s)
            if N[i] not in s:
                temp_ans.append(N[i]+s)
    #print(temp_ans)
    return len(temp_ans) % (10**9 + 7)
"""


def problem_a(input_string):
    S = int(input_string[0].rstrip())
    N = input_string[1].rstrip()
    #print(S)
    dic = {}
    c = 0
    for i in range(S)[::-1]:
        if N[i] not in dic:
            dic[N[i]] = 1
            #c += i+1
        else:
            dic[N[i]] += 1

    c = 1
    for key, value in dic.items():
        c *= (value+1)
    c -= 1
    """
    c += 2**len(dic.keys())-1
    #print(c)
    #c += S
    for key, value in dic.items():
        if value > 1:
            #c -= (value-1)
            c += 2**(len(dic.keys()))-1
            #print(c)
    #for key, value in dic.items():
    for key, value in dic.items():
        if value > 1:
            if len(dic.keys()) != S:
                c -= 2**(S-len(dic.keys())-1)
    """
            #print(c)
        #else:
    #c += (S-len(dic.keys()))
    """
    s_N = sorted(N)
    for i in range(S-1):
        if s_N[i] != s_N[i+1]:
            c += 2**(i+2)
    """
    """
    for key, value in dic.items():
        if value > 1:
            c += 2**(len(dic.items())-value)
        else:
            c += 2**(len(dic.items())-value)
    """
    #combinations_count(len(, r)

    return c % (10**9 + 7)


def main():
    input_line = stdin.readlines()
    answer = problem_a(input_line)
    print(answer)


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


def cost(n, k, nums):
    dp = [0 for _ in range(n)]
    dp[0] = 0
    dp[1] = abs(nums[1] - nums[0])
    for i in range(2, n):
        mincost = float('inf')
        for j in range(1, k+1):
            if i-j >= 0:
                mincost = min(mincost, dp[i-j] + abs(nums[i] - nums[i-j]))
        dp[i] = mincost
    return dp[-1]

# n, k = 10, 4
# nums = [40, 10, 20, 70, 80, 10, 20, 70, 80, 60]
n, k = [int(i) for i in input().split()]
nums = [int(i) for i in input().split()]
print(cost(n, k, nums))

### FIXED CODE ###


def cost(n, k, nums):
    dp = [0] * n
    dp[0] = 0
    dp[1] = abs(nums[0] - nums[1])
    for i in range(2, n):
        dp[i] = min(abs(nums[i]-nums[j]) + dp[j] for j in range(max(0, i-k), i))
    return dp[-1]

n, k = [int(i) for i in input().split()]
nums = [int(i) for i in input().split()]
print(cost(n, k, nums))
### BUGGY CODE ###

import sys
input = sys.stdin.readline
M = 10**9+7
n = int(input())
l = list(map(int,input().split()))
o = [0]*61
z = [0]*61
for i in l:
    a = bin(i)
    a = a[2:]
    j = 0
    while(j < len(a)):
        if a[j] == "1":
            o[len(a)-j-1] = o[len(a)-j-1]+1

        j = j+1

cnt = 0
b = 1
for j in range(len(o)):
    cnt = (cnt+(o[j]*(n-o[j])*b)%M)%M
    b = b*2

print(cnt)

### FIXED CODE ###

def readinput():
    n=int(input())
    l=list(map(int,input().split()))
    return n,l

def main(n,a):
    MOD=10**9+7
    hist=[0]*61
    bs=[]
    for i in range(n):
        # s=list(reversed(bin(a[i])[2:]))
        # for j in range(len(s)):
        #     if s[j]=='1':
        #         hist[j]+=1
        # bs.append(s)

        s=bin(a[i])[2:]
        for j in range(len(s)):
            if s[j]=='1':
                hist[len(s)-j-1]+=1
        # j=0
        # ai=a[i]
        # while ai>0:
        #     if ai&1==1:
        #         hist[j]+=1
        #     ai = ai >> 1
        #     j+=1


    #print(bs)
    #print(hist)
    #print(hist)
    sum=0
    # for i in range(n-1):
    #     s=bs[i]
    #     b=1
    #     for j in range(len(s)):
    #         if s[j]=='0':
    #             sum=(sum+hist[j]*b)%MOD
    #         else:
    #             sum=(sum+( n-i-hist[j] )*b)%MOD
    #             hist[j]-=1
    #         b*=2
    #     for j in range(len(s),61):
    #         sum=(sum+hist[j]*b)%MOD
    #         b*=2
    b=1
    for j in range(61):
        sum=(sum+( hist[j]*(n-hist[j])*b )%MOD )%MOD
        b*=2

    return sum

if __name__=='__main__':
    n,l=readinput()
    ans=main(n,l)
    print(ans)