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

#create date: 2020-07-25 09:13

import sys
stdin = sys.stdin
mod = 10**9+7

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n, m = na()
    a = list()
    for i in range(m):
        a.append(ni())

    dp = [0] * (10**5+1)
    dp[0] = 1
    if not 1 in a: dp[1] = 1
    for i in range(2, n+1):
        if i in a:
            dp[i] = 0
        else:
            dp[i] = (dp[i-2] + dp[i-1]) % mod
    print(dp[n])

if __name__ == "__main__":
    main()

### FIXED CODE ###

#create date: 2020-07-25 09:13

import sys
stdin = sys.stdin
mod = 10**9+7

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n, m = na()
    a = [0] * (10**5+1)
    for i in range(m):
        st = ni()
        a[st] = 1

    dp = [0] * (10**5+1)
    dp[0] = 1
    if a[1] == 0: dp[1] = 1
    for i in range(2, n+1):
        if a[i] == 1:
            dp[i] = 0
        else:
            dp[i] = (dp[i-2] + dp[i-1]) % mod
    print(dp[n])

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

n=int(input())
A=list(map(int,input().split()))
B=[]
S=''
for i in range(1,n+1):
  B.append(A.index(i)+1)
for i in range(n):
  S+=str(B[i])+' '
print(S)

### FIXED CODE ###

n=int(input())
A=[]*n
A[:]=map(int,input().split())
S=[' ']*n
for i in range(n):
  S[A[i]-1]=str(i+1)
print(' '.join(S))
### BUGGY CODE ###

import numpy as np
N, K = map(int, input().split())
tmp = input().split(' ')
A = []
for i in range(N):
    A = A + [int(tmp[i])]

Z = np.array([[abs(j - i) for j in range(N)] for i in range(N)])

B = [0]*5
while K > 0:
    K = K - 1
    for i in range(N):
        B[i] = np.count_nonzero(A >= Z[i])

    A[:] = B[:]

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

### FIXED CODE ###

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

    Z = [N]*N

    while K > 0 and A != Z:
        K-=1
        B = [int(0)]*(N+1)
        for i in range(N):
            B[max(int(0),i-A[i])]+=1
            B[min(N-1,i+A[i])+1]-=1
        for i in range(1,N):
            B[i]+=B[i-1]

        A = B[0:N]

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

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

import math
 
def yo(n):
    if n==1:    return False
    s=2
    while s <= int(math.sqrt(n)):
        if n%s == 0:    return False
        s+=1
    return True
 
while True:
    c=0
    try:
        for i in range(1, int(input())+1):
            if yo(i)==True:    c+=1
        print(c)
    except:
        break

### FIXED CODE ###

def pri(s,n): 
    tab=[i for i in range(n+1) if s[i] and i>=2]
    return(tab)
 
s=[True for _ in range(999999+1)]
i=2
while i**2<=999999:
    if s[i]:
        j=i*2
        while j<=999999:
            s[j]=False
            j+=i
    i+=1

while True:
    try:
        print(len(pri(s,int(input()))))
    except:
        break
### BUGGY CODE ###

import sys
a,b,k = map(int, sys.stdin.readline().split())

l = [x for x in range(a, b+1)]

left = set(l[:k])
right = set(l[-k:])

sum = left | right

for i in sorted(sum):
    print(i)

### FIXED CODE ###

import sys
a,b,k = map(int, sys.stdin.readline().split())

s = set(range(a,a+k)) | set(range(b-k+1,b+1))

for i in sorted(s):
    if a <= i <= b:
        print(i)
### BUGGY CODE ###

import sys
from math import factorial
n = int(input())
c_ls = [int(i) for i in sys.stdin.readline().split()]
c_ls.sort(reverse=True)
MOD = 10**9+7

res = 0
for i, c in enumerate(c_ls):
    res += (2 ** (n - 1) + 2 ** (n - 2) * i) * c
    res %= MOD
res = res * (2**n) % MOD
print(int(res))

### FIXED CODE ###

import sys

n = int(input())
c_ls = [int(i) for i in sys.stdin.readline().split()]
c_ls.sort(reverse=True)
MOD = 10 ** 9 + 7

res = 0
for i, c in enumerate(c_ls):
    res += (i + 2) * c % MOD
    res %= MOD
res = res * (4 ** (n - 1)) % MOD
print(int(res))
### BUGGY CODE ###

import math
N,M=map(int,input().split())
a=[]
for i in range(M):
    tmp=list(map(int,input().split()))
    tmpc=list(map(int,input().split()))
    c=0
    for j in range(len(tmpc)):
        c+=2**(tmpc[j]-1)
    tmp[1]=c
    a+=[tmp]


dp=[[10**10 for j in range(2**N)] for i in range(M)]
dp[0][0]=0
dp[0][a[0][1]]=a[0][0]


for i in range(1,M):
    dp[i]=dp[i-1]
    for j in range(2**N):
        q=j|a[i][1]
        dp[i][q]=min(dp[i-1][j]+a[i][0],dp[i][q])

ans=dp[M-1][2**N-1]
print(ans if ans<10**10 else -1)

### FIXED CODE ###

def main():
    N,M=map(int,input().split())
    L=2**N
    dp=[10**10 for i in range(L)]
    dp[0]=0


    for i in range(M):
        a, _ = map(int, input().split())
        key=sum([2**(int(i)-1) for i in input().split()])
        for j in range(L):
                q=j|key
                dp[q]=min(dp[j]+a,dp[q])


    ans=dp[L-1]
    print(ans if ans<10**10 else -1)

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

s = input()
res = 0
while True:
  if 'BW' in s:
    s = s[:s.index('BW')] + 'WB' + s[s.index('BW')+2:]
    res += 1
  else:
    break
print(res)

### FIXED CODE ###

s = input()
res = 0
B = 0
for i in range(len(s)):
  if s[i] == 'B':
    B += 1
  else:
    res += B
print(res)
### BUGGY CODE ###

import numpy as np
N, M = map(int, input().split())

AB = []

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

AB.sort(key=lambda x: x[0])

ans = 0
cnt = 0
whole = []

for ab in AB:
    for b in range(ab[1]):
        whole.append(ab[0])

whole = np.array(whole)
whole = whole.cumsum()

print(whole[M-1])

### FIXED CODE ###

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

AB = []

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

AB.sort()

ans = 0
cnt = 0

for ab in AB:
    for b in range(ab[1]):
        ans += ab[0]
        cnt += 1
        if cnt==M:
            break
    if cnt==M:
        break

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

n, m = map(int, input().split())
a=[0 for i in range(n)]
b=[0 for i in range(n)]
price=0
for i in range(n):
    a[i],b[i] = map(int, input().split())
while(m>0):
    num=a.index(min(a))
    if(b[num]<m):
        price+=b[num]*a[num]
        m-=b[num]
        del a[num]
        del b[num]
    else:
        price+=m*a[num]
        m=0
print(price)

### FIXED CODE ###

n, m = map(int, input().split())
a=[0 for i in range(n)]
b=[0 for i in range(n)]
c=[[0 for i in range(2)] for i in range (n)]
for i in range(n):
    a[i],b[i] = map(int, input().split())
for i in range(n):
    c[i][0]=a[i]
for i in range(n):
    c[i][1]=b[i]
c.sort()
price=0
i=0
while(m>0):
    if(m>c[i][1]):
        price+=c[i][0]*c[i][1]
        m-=c[i][1]
    else:
        price+=c[i][0]*m
        m=0
    i+=1
print(price)
### BUGGY CODE ###

import bisect,collections,copy,heapq,itertools,math,numpy,string
import itertools,sys
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
N,K = LI()
h = LI()
dp = [float('INF')]*N
dp[0] = 0
for i,j in itertools.product(range(N),range(1,K+1)):
    if i+j>=N:
        continue
    dp[i+j] = min(dp[i+j],dp[i]+abs(h[i+j]-h[i]))
print(dp[-1])


### FIXED CODE ###

def main(N, K, h):
    dp = [float('INF')] * N
    dp[0] = 0
    for i in range(N):
        for j in range(1,K+1):
            if i+j <= N-1:
                dp[i+j] = min(dp[i+j], dp[i] + (abs(h[i+j] - h[i])))
    return dp[-1]

N,K = map(int, input().split())
h = list(map(int,input().split()))
print(main(N, K, h))
### BUGGY CODE ###

n,m = map(int,input().split())
alis = list(map(int,input().split()))
lis = [list(map(int,input().split())) for x in range(m)]
clis = [[x[1]]*x[0] for x in lis]
clis = [x for y in clis for x in y]
clis.sort(reverse=True)
alis.sort()
ans = 0
for x,y in zip(alis,clis):
    if x>=y:
        ans += x
    else:
        ans += y
if len(clis) < len(alis):
    ans__ = sum(alis[len(clis):])
    ans += ans__
    print(ans)
else:
    print(ans)


### FIXED CODE ###

n,m = map(int,input().split())
alis = list(map(int,input().split()))
lis = [list(map(int,input().split())) for x in range(m)]
for x in alis:
    lis.append([1,x])
lis.sort(reverse=True,key=lambda x:x[1])
ans = 0
for x in lis:
    (number,point) = x
    if number >= n:
        number = n
        ans += number * point
        #print(n)
        #print(ans,'+=',number,'*',point)
        break
    ans += number * point
    n -= number
    #print(n)
    #print(ans,'+=',number,'*',point)
print(ans)
#print(lis)
### BUGGY CODE ###

from bisect import bisect_right, insort_right

N = int(input())
A = [int(input()) for _ in range(N)]
B = [A[-1]]
for a in reversed(A[:-1]):
    idx = bisect_right(B, a)
    if idx == len(B):
        insort_right(B, a)
    else:
        B[idx] = a
        B.sort()
print(len(B))

### FIXED CODE ###

from bisect import bisect_right

N = int(input())
A = [int(input()) for _ in range(N)]
B = [A[-1]]
ans = 1
for a in reversed(A[:-1]):
    idx = bisect_right(B, a)
    if idx == ans:
        B.append(a)
        ans += 1
    else:
        B[idx] = a
print(ans)
### BUGGY CODE ###

n,k=map(int,input().split())
loop_=[1]
lst=list(map(int,input().split()))
 
for i in range(k):
    num=lst[loop_[-1]-1]
    if num in loop_:
        tar=num
        break
    else:
        loop_.append(num)
    if i==k-1:
        print(loop_[k])
        exit() 
        
loop__=loop_[loop_.index(tar):]
 
if k<=len(loop_):
    print(loop_[k])
else:
    num=k+1-len(loop_)
    print(loop__[num%len(loop__)-1])

### FIXED CODE ###

n,k=map(int,input().split())
loop_=[1]
l_set=set()
lst=list(map(int,input().split()))

tar=None
for i in range(k):
    num=lst[loop_[-1]-1]
    if num in l_set:
        tar=num
        break
    else:
        loop_.append(num)
        l_set.add(num)

if tar==None:
    print(loop_[k])
    exit()    
loop__=loop_[loop_.index(tar):]

num=k+1-len(loop_)
try:
  print(loop__[num%len(loop__)-1])
except:
  print(1)
### BUGGY CODE ###

N = int(input())
for h in range(1, 3501):
  for n in range(1, 3501):
    a = N*h*n
    b = 4*h*n - N*n - N*h
    if b == 0:
      continue
    if a % b:
      continue
    print(h, n, a//b)


### FIXED CODE ###

N = int(input())
for h in range(1, 3501):
  for n in range(1, 3501):
    a = N*h*n
    b = 4*h*n - N*n - N*h
    if b == 0:
      continue
    if a % b:
      continue
    if a//b < 0:
      continue
    print(h, n, a//b)
    exit()
### BUGGY CODE ###

H,W,N = [int(input()) for i in range(3)]
o = 1
a = N / o
while a <= H or W:
  if H <= W and a > W:
      o += 1
  elif W <= H and a > H:
      o += 1
print(o)    
    
    
    





	

  
  
  



### FIXED CODE ###

H,W,N = [int(input()) for i in range(3)]
for o in range(1,10000):
  if H <= W and N / o <= W:
    break
  elif H >= W and N / o <= H:
    break
print(o)
### BUGGY CODE ###

N = int(input())
s = []
for i in range(N):
    s.append(''.join(sorted(input())))

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


### FIXED CODE ###

N = int(input())
s = [''.join(sorted(input())) for i in range(N)]

ans = 0
d = {}
for i in s:
    if i in d:
        ans += d[i]
        d[i] += 1
    else:
        d[i] = 1
print(ans)
### BUGGY CODE ###

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

n = 0
for i in range(a, b+1):
  if i < 0:
    n += 1
  elif i == 0:
    print('Zero')
    exit()

if n%2 == 1:
  print('Negative')
else:
  print('Positive')

### FIXED CODE ###

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

if a > 0 and b > 0:
  print('Positive')
elif a < 0 and b < 0:
  if (b-a+1)%2 == 0:
    print('Positive')
  else:
    print('Negative')
else:
  print('Zero')
### BUGGY CODE ###

n = int(input())
adjacency_list = [list(map(int, input().split())) for i in range(n)]
egde = []
for u in range(n):
    for v in range(u):
        egde.append([adjacency_list[u][v], u, v])
egde.sort()

ans = 0
for d, u, v in egde:
    for w in range(n):
        if w == u or w == v:
            continue
        d2 = adjacency_list[u][w] + adjacency_list[w][v]
        if d == d2:
            break
        elif d > d2:
            print(-1)
            exit()
    else:
        ans += d

print(ans)


### FIXED CODE ###

import sys
import numpy as np
input = sys.stdin.readline
n = int(input())
G = np.array([list(map(int, input().split())) for _ in range(n)], dtype=float)
use = np.ones((n,n),dtype=bool)
impossible = np.zeros((n,n),dtype=bool)
for w in range(n):
    D = sum(np.meshgrid(G[w], G[w]))
    D[w] = np.inf
    D[:,w] = np.inf
    use &= ~(G == D)
    impossible |= G > D
if impossible.any():
    print(-1)
else:
    print(int(np.sum(G[use]) / 2))
### BUGGY CODE ###

# https://atcoder.jp/contests/dp/tasks/dp_b

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

dp = [0] * (N)
dp[0] = 0

# 参考：https://atcoder.jp/contests/dp/submissions/10181844
for i in range(1, N):
    tmp = [dp[k] + abs(h[i] - h[k]) for k in range(max(0, i - K), i)]
    dp[i] = min(tmp)
print(dp[-1])


### FIXED CODE ###

# https://atcoder.jp/contests/dp/tasks/dp_b

def main():
    N, K = map(int, input().split())
    h = [int(x) for x in input().split()]

    dp = [0] * (N)
    dp[0] = 0

    # 参考：https://atcoder.jp/contests/dp/submissions/10181844
    for i in range(1, N):
        tmp = [dp[k] + abs(h[i] - h[k]) for k in range(max(0, i - K), i)]
        dp[i] = min(tmp)
    print(dp[-1])


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

mod=10**9+7
n=int(input())
T=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]
Chk_T,Chk_A=[False]*n,[False]*n
Max_T,Max_A=[0]*n,[0]*n
Chk_T[0],Chk_A[-1]=True,True
Max_T[0],Max_A[-1]=T[0],A[-1]

for i in range(1,n):
  if T[i]!=T[i-1]:
    Chk_T[i]=True
  Max_T[i]=T[i]
  if A[-i-1]!=A[-i]:
    Chk_A[-i-1]=True
  Max_A[-i-1]=A[-i-1]
ans=1
flag=True
for i in range(n):
  if Chk_T[i]==False and Chk_A[i]==False:
    ans*=min(Max_T[i],Max_A[i])
  elif Chk_T[i]==True and Chk_A[i]==False:
    if Max_T[i]>Max_A[i]:
      flag=False
  elif Chk_T[i]==False and Chk_A[i]==True:
    if Max_T[i]<Max_A[i]:
      flag=False
  else:
    if Max_T[i]!=Max_A[i]:
      flag=False
print(0 if flag==False else ans%mod)

### FIXED CODE ###

mod=10**9+7
n=int(input())
T=[int(i) for i in input().split()]
A=[int(i) for i in input().split()]
Tres=[0]*n
Ares=[0]*n
Tres[0]=(0,T[0])
Ares[n-1]=(0,A[n-1])
for i in range(1,n):
  if T[i]>Tres[i-1][1]:
    Tres[i]=(0,T[i])
  else:
    Tres[i]=(1,T[i])
  if A[n-i-1]>Ares[n-i][1]:
    Ares[n-i-1]=(0,A[n-i-1])
  else:
    Ares[n-i-1]=(1,A[n-i-1])
if Tres[0]<=Ares[0]:
  ans=1
else:
  ans=0
for i in range(1,n):
  ta,tb=Tres[i]
  aa,ab=Ares[i]  
  if ta==aa==1:
    ans=ans*min(tb,ab)%mod
  elif ta==0 and aa==1 and tb>ab:
    ans=0
  elif ta==1 and aa==0 and tb<ab:
    ans=0
  elif ta==0 and aa==0 and tb!=ab:
    ans=0
print(ans%mod)
### BUGGY CODE ###

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

maxcnt=0
for i in range(n):
    cnt=0
    for j in range(i+1,n-1):
        if h[j+1] <= h[j]:
            cnt +=1
        else:
            break
    if cnt>maxcnt:
        maxcnt=cnt
print(maxcnt)

### FIXED CODE ###

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

maxcnt=0
st=0
while st < n-1:
    cnt=0
    j=st
    while j < n-1:
        if h[j+1] <= h[j]:
            cnt +=1
            j += 1
        else:
            break
    if cnt>maxcnt:
        maxcnt=cnt
    st = j+1

print(maxcnt)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort()
b.sort()
c.sort()

ans = 0
for i in range(n):
    left = n - 1
    right = 0
    b_mid = n // 2
    while left >= right:
        if b[b_mid] > a[i]:
            left = b_mid - 1
        else:
            right = b_mid + 1
        b_mid = (left + right) // 2
    b_mid += 1

    for j in range(b_mid, n):
        left = n - 1
        right = 0
        c_mid = n // 2
        while left >= right:
            if c[c_mid] > b[j]:
                left = c_mid - 1
            else:
                right = c_mid + 1
            c_mid = (left + right) // 2
        ans += n - c_mid - 1
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort()
b.sort()
c.sort()

ans = 0
i = []
k = []
for j in range(n):
    left = n - 1
    right = 0
    a_mid = n // 2
    while left >= right:
        if a[a_mid] >= b[j]:
            left = a_mid - 1
        else:
            right = a_mid + 1
        a_mid = (left + right) // 2
    i.append(a_mid + 1)
    
for j in range(n):
    left = n - 1
    right = 0
    c_mid = n // 2
    while left >= right:
        if c[c_mid] > b[j]:
            left = c_mid - 1
        else:
            right = c_mid + 1
        c_mid = (left + right) // 2
    k.append(n - c_mid - 1)

ans = sum(x * y for x, y in zip(i, k))
print(ans)
### BUGGY CODE ###

def main():
    n = 13
    mod = 1000000007
    r = 5
    in_str = input()

    amari_list = amari(n)
    l = len(amari_list)

    ans_list = initial(in_str[-1:], n)

    for i, s in enumerate(reversed(in_str)):
        if i == 0:
            continue
        if s == "?":
            tmp_list, ans_list = ans_list, [0]*n
            for j in range(10):
                t = j * amari_list[i % l] % n
                ans_list = shift_add(t, tmp_list, ans_list)
        else:
            t = int(s) * amari_list[i % l] % n
            ans_list = shift(t, ans_list)

        ans_list = list(map(lambda x: x % mod, ans_list))

    print(ans_list[r] % mod)


def shift(r, num_list):
    l = len(num_list)
    return [num_list[(i + l - r) % l] for i in range(l)]


def shift_add(r, num_list, ans_list):
    l = len(num_list)
    return [num_list[(i + l - r) % l]+ans_list[i] for i in range(l)]


def initial(s, n):
    if s == "?":
        return [1 if i < 10 else 0 for i in range(n)]
    else:
        return [1 if i == int(s) else 0 for i in range(n)]


def amari(n):
    ret = []
    for i in range(n+1):
        r = (10**i) % n
        if r in ret:
            return ret
        else:
            ret.append(r)


if __name__ == '__main__':
    main()

### FIXED CODE ###

import numpy as np


def main():
    n = 13
    mod = 1000000007
    r = 5
    in_str = input()

    amari_l = amari_list(n)
    amari_m = amari_matrix(n, amari_l)

    ans_list = initial(in_str[-1:], n)

    for i, s in enumerate(reversed(in_str)):
        if i == 0:
            continue
        if s == "?":
            ans_list = np.dot(ans_list, amari_m[i % len(amari_m)]) % mod
        else:
            t = int(s) * amari_l[i % len(amari_l)] % n
            ans_list = np.roll(ans_list, t)

    print(int(ans_list[r] % mod))


def initial(s, n):
    if s == "?":
        return np.array([1 if i < 10 else 0 for i in range(n)], dtype='int64')
    else:
        return np.array([1 if i == int(s) else 0 for i in range(n)], dtype='int64')


def shift(n, r):
    return np.array([[1 if (i - j + r) % n == 0 else 0 for j in range(n)] for i in range(n)])


def amari_list(n):
    ret = []
    for i in range(n + 1):
        r = 10**i % n
        if r in ret:
            return ret
        else:
            ret.append(r)


def amari_matrix(n, amari_list):
    ret = np.zeros((len(amari_list), n, n))
    for i, j in enumerate(amari_list):
        tmp = np.zeros((n, n))
        for k in range(10):
            tmp += shift(n, j * k % n)
        ret[i] = tmp
    return ret


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

import collections
import math
def cmb(n, r):
    if n < r:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(input())
la = list(map(int,input().split()))
c = collections.Counter(la)
#print(c)
ans = 0
for i in range(N):
    c[la[i]] -= 1
    #print(c)
    for a in c:
        #print(a)
        ans += cmb(c[a],2)
    print(ans)
    ans = 0
    c[la[i]]+=1


### FIXED CODE ###

import collections
import math
def cmb(n, r):
    if n < r:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N = int(input())
la = list(map(int,input().split()))
all = 0
c = collections.Counter(la)
#print(c)
for i in range(N+1):
    all += cmb(c[i],2)
#print(all)
for k in range(N):
    print(all-c[la[k]]+1)
### BUGGY CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
s = 1
for i in range(k):
    s *= a[i]

pre = s
for i in range(k, n):
    s *= a[i]
    s //= a[i-k]
    if pre < s:
        print('Yes')
    else:
        print('No')
    pre = s

### FIXED CODE ###

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

for i in range(k, n):
    if a[i] > a[i-k]:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

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

maxans = 0
for i in range(N):
    ans = 0
    for j in range(i + 1, N):
        if H[j] > H[j - 1]:
            break
        ans += 1
    maxans = max(maxans, ans)
print(maxans)

### FIXED CODE ###

#

import sys
input=sys.stdin.readline

def main():
    N=int(input())
    H=list(map(int,input().split()))
    H=H[::-1]
    cnt=[0]*N
    for i in range(1,N):
        if H[i]>=H[i-1]:
            cnt[i]=cnt[i-1]+1
    print(max(cnt))
    
    
    
if __name__=="__main__":
    main()
### BUGGY CODE ###

import itertools


def solve():
    N = int(input())
    A = list(map(int, input().split(" ")))
    B = list(map(int, input().split(" ")))
    C = list(map(int, input().split(" ")))

    cnt = 0
    for ele in list((itertools.product(A, B, C))):
        if ele[0] < ele[1] < ele[2]:
            cnt += 1

    print(cnt)

 
solve()

### FIXED CODE ###

#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
import math
import itertools
import heapq
import numpy as np
from collections import OrderedDict, deque, Counter
from bisect import bisect_left, bisect_right, insort_left, insort_right
sys.setrecursionlimit(10000)

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]


def solve():
    N = int(input())
    A = sorted(list(map(int, input().split(" "))))
    B = sorted(list(map(int, input().split(" "))))
    C = sorted(list(map(int, input().split(" "))))

    cnt = 0
    for ele in B:
        cnt += bisect_left(A, ele) * (N - bisect_right(C, ele))

    print(cnt)


solve()
### BUGGY CODE ###

a,b,c,k=map(int,input().split())
ct = 0
result = 0
while k>ct and a>0:
    result=result+1
    a=a-1
    ct=ct+1
while k>ct and b>0:
    b=b-1
    ct=ct+1
while k>ct and c>0:
    c=c-1
    result=result-1
    ct=ct+1

print(result)

### FIXED CODE ###

a,b,c,k=map(int,input().split())
ct=k
result = 0
if a>0:
  if ct>a:
    result=1*a
  elif a>=ct:
    result=1*ct
  ct=k-a
if ct>0 and b>0:
  ct=ct-b
if ct>0 and c>0:
  result=result+(-1*ct)
print(result)
### BUGGY CODE ###

import sys
from math import log2,floor
N = int(sys.stdin.readline().rstrip())
A = list(map(int,sys.stdin.readline().split()))
mod = 10**9+7
ans = 0
for i in range(61):
    bits = 0
    for x in A:
        if (x>>i)&1:
            bits += 1
    s = (bits*(N-bits))%mod
    t = (2**i)%mod
    ans = (ans+s*t)%mod
print(ans)

### FIXED CODE ###

import sys
stdin = sys.stdin
 
mod = 10**9 + 7
 
def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))
 
def main():
    n = ni()
    a = na()
    ans = 0
    for i in range(61):
        cnt = 0
        for ai in a:
            if (ai >> i) & 1:
                cnt += 1
        ans += ((cnt * (n - cnt)) * 2**i) % mod
    ans %= mod
    print(ans)
 
 
if __name__ == "__main__":
    main()