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

n, k = map(int, input().split())
s = "1" + input() + "1"

ZERO, ONE = [], []
now = "1"
count = 0
for c in s:
    if c == now:
        count += 1
    else:
        if now == "0":
            ZERO.append(count)
        else:
            ONE.append(count)
        now = c
        count = 1
ONE.append(count)
ONE[0] -= 1; ONE[-1] -= 1

m = len(ZERO)
if k >= m:
    print(n)
    exit()

answer = 0
for i in range(m - k + 1):
    temporary = sum(ZERO[i:i + k]) + sum(ONE[i:i + k + 1])
    answer = max(answer, temporary)

print(answer)


### FIXED CODE ###

n, k = map(int, input().split())
s = "1" + input() + "1"

ZERO, ONE = [], []
now = "1"
count = 0
for c in s:
    if c == now:
        count += 1
    else:
        if now == "0":
            ZERO.append(count)
        else:
            ONE.append(count)
        now = c
        count = 1
ONE.append(count)
ONE[0] -= 1; ONE[-1] -= 1

m = len(ZERO)
if k >= m:
    print(n)
    exit()

answer = temporary = sum(ZERO[:k]) + sum(ONE[:k + 1])
for i in range(m - k):
    temporary += ZERO[i + k] + ONE[i + k + 1]
    temporary -= ZERO[i] + ONE[i]
    answer = max(answer, temporary)

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

s=input()

p=[0]*len(s)

for i in range(len(s)):
    if s[i]=="R":
        index = s[i:].index("L")
        index = i + index - (index)%2
        p[index] +=1


    if s[i]=="L":
        index = s[i::-1].index("R")
        index = i - index + (index)%2
        p[index] +=1

for i in p:
    print(i,end=" ")


### FIXED CODE ###

s=input()+"R"


p=[0]*(len(s)-1)
key=s[0]
strt=0
for i in range(len(s)):

    if key!=s[i]:
        if key=="R":
            p[i]  += (i-strt)//2
            p[i-1] += (i-strt)//2 + (i-strt)%2
            key="L"
        else:
            p[strt] += (i-strt)//2 + (i-strt)%2
            p[strt-1] += (i-strt)//2
            key="R"
        strt=i

for i in p:
    print(i,end=" ")
### BUGGY CODE ###

n = int(input())
p = []

ans = 0
for i in range(n):
    ans += i

print(ans)

### FIXED CODE ###

import sys

n = int(input())

if n == 2:
    print(1)
    sys.exit()

# temp1 = (n-1) // 2
# temp2 = 2 + n - 2
#ans = ((n-1) / 2) * (2 + (n - 2))
ans = (n-1) * (2 + (n - 2))
ans = ans // 2
#ans = temp1 * temp2

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

N = int(input())
s = list(input())
L = [[], [], []]
for i in range(N):
  if s[i] == 'R':
    L[0].append(i)
  elif s[i] == 'G':
    L[1].append(i)
  else:
    L[2].append(i)
ans = len(L[0]) * len(L[1]) * len(L[2])
for i in L[0]:
  for j in L[1]:
    if (2 * i - j) in L[2]:
      ans = ans - 1
    if (2 * j - i) in L[2]:
      ans = ans - 1
    if (i - j) % 2 == 0 and int((i+j)/2) in L[2]:
      ans = ans - 1
print(ans)

### FIXED CODE ###

N = int(input())
S = list(input())
R = []
G = []
for i in range(N):
  if S[i] == "R":
    R.append(i)
  elif S[i] == "G":
    G.append(i)
r = len(R)
g = len(G)
ans = r * g * (N - r - g)
for i in R:
  for j in G:
    a = 2 * i - j
    b = 2 * j - i
    c = i + j
    if 0 <= a < N and S[a] == "B":
      ans -= 1
    if 0 <= b < N and S[b] == "B":
      ans -= 1
    if c % 2 == 0 and S[c//2] == "B":
      ans -= 1
print(ans)
### BUGGY CODE ###

t=int(input())
for _ in range(t):
    a,b,c,d=map(int,input().split())
    e=b*(max((a-c)//b,1))
    a-=e
    while a>c:
        a-=b
    if a<0:
        print('No')
        continue
    if d<b:
        print('No')
        continue
    if c<=b and d>b:
        """
        while a<=c:
            a+=(d-b)
        """
        a+=(d-b)*((c-a-1)//(d-b))
        while a<=c:
            a+=(d-b)
        if a<b:
            print('No')
            continue
        else:
            f=a-b
            ff=0
            for __ in range(100000):
                f+=(d-b)*((c-f-1)//(d-b))
                while f<=c:
                    f+=(d-b)
                if f<b:
                    print('No')
                    ff=1
                    break
                f=f-b
            if ff:continue
    print('Yes')
    


### FIXED CODE ###

from fractions import*
_,*t=open(0)
for t in t:
  a,b,c,d=map(int,t.split())
  g=gcd(b,d)
  print('YNeos'[b>min(a,d)or b-g+a%g>c::2])
### BUGGY CODE ###

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

if m == 0:
    if k == 0:
        print('0 0')
    else:
        print('-1')
elif m == 1:
    if k == 0:
        print('0 0 1 1')
    elif k >= 1:
        print('-1')
else:
    if k < 2 ** m:
        l = []
        for i in range(2 ** m):
            if i != k:
                l.append(i)

        ans = l + [k] + l[::-1] + [k]

        ans2 = ''
        for a in ans:
            ans2 += str(a) + ' '
        print(ans2[:-1])
    else:
        print(-1)


### FIXED CODE ###

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

if m == 0:
    if k == 0:
        print('0 0')
    else:
        print('-1')
elif m == 1:
    if k == 0:
        print('0 0 1 1')
    elif k >= 1:
        print('-1')
else:
    if k < 2 ** m:
        l = list(range(2 ** m))
        l.pop(k)
        ans = l + [k] + l[::-1] + [k]
        print(' '.join(map(str, ans)))
    else:
        print(-1)
### BUGGY CODE ###

import math
import sys

n, m = map(int, input().split())
a_list = [None] * (m + 2)
a_list[0] = -1
for i in range(m):
    a_list[i+1] = int(input())
a_list[-1] = n + 1

fact_memo = dict()
def fact(n):
    if n in fact_memo.keys():
        return fact_memo[n]
    f = math.factorial(n)
    fact_memo[n] = f
    return f

memo = dict()
ans = 1
cur = a_list[0]
for i, a in enumerate(a_list):
    if i == 0:
        continue
    sub = a - cur - 1
    cur = a
    if sub <= 2:
        if sub == 0:
            print(0)
            sys.exit()
        continue
    sub -= 1
    if sub in memo.keys():
        ans *= memo[sub]
        continue
    count = sum(fact(sub - j) // fact(j) // fact(sub - j*2) for j in range(sub // 2 + 1))
    memo[sub] = count
    ans *= count
print(ans % 1000000007)


### FIXED CODE ###

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

N, M = map(int, readline().split())
ans = [0] * (N + 2)
ans[0] = 1
for _ in range(M):
    a = int(readline())
    ans[a] = -1

for i in range(1, N + 1):
    if ans[i] == -1:
        continue
    a1 = max(ans[i - 2], 0)
    a2 = max(ans[i - 1], 0)
    ans[i] = a1 + a2

print(ans[N] % (10 ** 9 + 7))
### BUGGY CODE ###

from fractions import gcd
n = int(input())
a = list(map(int, input().split()))

ans = []
for i in range(n):
  for j in range(i+1):
    ans.append(gcd(a[i], a[j]))
print(min(ans))
    

### FIXED CODE ###

from fractions import gcd
n = int(input())
a = list(map(int, input().split()))

ans = gcd(a[0], a[1])
for i in range(2, len(a)):
  ans = gcd(ans, a[i])
print(ans)
### BUGGY CODE ###

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

ans = 1
for i in range(1, N):
    m = min(P[0:i])
    if P[i] > m:
        continue
    ans += 1

print(ans)

### FIXED CODE ###

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

ans = 1
m = P[0]
for i in range(1, N):
    m = min(m, P[i])
    if m == P[i]:
        ans += 1

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

S=input()
Q=int(input())
Q=[input().split() for i in range(Q)]

for i in Q:
    if i[0]=='1':
        S=S[::-1]
    else:
        if i[1]=='1':
            S=i[2]+S
        else:
            S=S+i[2]
print(S)

### FIXED CODE ###

S=input()
Q=int(input())
Q=[input().split() for i in range(Q)]
Forward=[]
Backward=[]
count=0
for i in Q:
    if i[0]=='1':
        count+=1
    else:
        if (int(i[1])+count)%2==1:
            Forward.append(i[2])
        else:
            Backward.append(i[2])  
if count%2==0:
    ans = (''.join(Forward))[::-1]+S+(''.join(Backward))
else:
    ans = (''.join(Backward)[::-1]+S[::-1]+(''.join(Forward)))
print(ans)
### BUGGY CODE ###

N = int(input())
A = [int(i) for i in input().split()]
t = []
for i in range(N):
    t.append(str(A.index(i + 1) + 1))
print(' '.join(t))

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
d = {v: str(k + 1) for k, v in enumerate(A)}
print(' '.join([v for _, v in sorted(d.items())]))
### BUGGY CODE ###

#各丸太を何回切るか、どこで切るか
#丸太iをKi回切る場合、その丸太の最小はL//Kiとなる
#あとは、どの丸太を何回切るかを求めればよい。
"""
長い丸太ほど多く切るべき
丸太が2本、1本が10**9でもう一本が1。10**9回切れるのであれば1本目に全振りするのがベスト。

結論、元の長さの比に基づいて割り当てればよい。
一番短い丸太の長さを1として各丸太の
"""
from math import ceil
import heapq
N,K = map(int,input().split())
A = list(map(int,input().split()))
A.sort()
pivot = A[0]
hiritu = [a/pivot for a in A]
hirituSum = sum(hiritu)
kaisu = []
for i in range(N):
    h = hiritu[i]
    kaisu.append(int(K*(h/hirituSum)))
    K -= int(K*(h/hirituSum))
leng = []
for i in range(N):
    a = A[i]
    k = kaisu[i]
    leng.append(((-a/(k+1)),k,a))
heapq.heapify(leng)
for _ in range(K):
    l,k,a = heapq.heappop(leng)
    l = -a/(k+2)
    heapq.heappush(leng,(l,k+1,a))
l,k,a = heapq.heappop(leng)
l *= -1
print(ceil(l))

### FIXED CODE ###

from math import ceil
N,K = map(int,input().split())
A = list(map(int,input().split()))

def is_ok(X):
    #最大値をX以下にできるか
    cnt = 0
    for a in A:
        cnt += ceil(a/X)-1
    return cnt <= K

def bisearch(high,low):
    while high - low > 1:
        mid = (high+low)//2
        if is_ok(mid):
            high = mid
        else:
            low = mid
    return high

print(bisearch(10**9+1,0))
### BUGGY CODE ###

N = int(input())

ans = [0] * (N+1)

for a in range(1, N+1):
    for i in range(1, int(N**0.5)):
        for j in range(1, i+1):
            tmp = a-i**2-j**2-i*j
            if tmp > 0:
                for k in range(1, int(tmp**0.5)+1):
                    tmp2 = k**2+k*(i+j)
                    if tmp == tmp2 and (i==j and j==k and k==i):
                        ans[a] += 1
                    elif tmp == tmp2 and (i != j and j != k and k != i):
                        ans[a] += 6
                    elif tmp == tmp2 and (i==j and j!=k):
                        ans[a] += 3

for i in range(1, N+1):
    print(ans[i])

### FIXED CODE ###

N = int(input())

ans = [0] * (N+1)

for i in range(1, 100):
    for j in range(1, 100):
        for k in range(1, 100):
            tmp = i**2+j**2+k**2+i*j+j*k+k*i
            if 1 <= tmp <= N:
                ans[tmp] += 1
for i in range(1, N+1):
    print(ans[i])
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
q = int(input())
for i in range(q):
    b, c = map(int, input().split())
    for j in range(n):
        if a[j] == b:
            a[j] = c
    print(sum(a[:]))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
mp, ans = {}, 0
for i in range(n):
    if(a[i] in mp.keys()):
        mp[a[i]] += 1
    else:
        mp[a[i]] = 1
for k in mp.keys():
    ans += k * mp[k]
q = int(input())
for i in range(q):
    b, c = map(int, input().split())
    if(b not in mp.keys()):
        mp[b] = 0
        print(ans)
        continue
    if(c in mp.keys()):
        mp[c] += mp[b]
    else:
        mp[c] = mp[b]
    ans += (c-b) * mp[b]
    mp[b] = 0
    print(ans)
### BUGGY CODE ###

N=int(input())
ans=1
for i in range(1,N+1):
  ans*=i
print(ans%(10**9 +7))

### FIXED CODE ###

import math
N=int(input())
ans=math.factorial(N)
print(ans%(10**9 +7))
### BUGGY CODE ###

H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

dp = [10 ** 18] * (2 * 10 ** 4 + 1)
dp[0] = 0
for a, b in AB:
    for i in range(H):
        dp[i + a] = min(dp[i + a], dp[i] + b)

ans = min(dp[H:])
print(ans)


### FIXED CODE ###

H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

dp = [10 ** 18] * (2 * 10 ** 4 + 1)
dp[0] = 0
for a, b in AB:
    for i in range(H):
        dp[i + a] = min(dp[i + a], dp[i] + b)

ans = min(dp[H:])
print(ans)
### BUGGY CODE ###

N, K = map(int, input().split())
c = []
for _ in range(N):
    a, b= map(int, input().split())
    for i in range(b):
        c.append(a)
print(sorted(c)[K-1])

### FIXED CODE ###

N, K = map(int, input().split())
num = [0]*(10**5+1)
for i in range(N):
    a, b= map(int, input().split())
    num[a] += b
for i in range(1, 10**5+1):
    if K <= num[i]:
        print(i)
        exit()
    K -= num[i]
### BUGGY CODE ###

N, P = map(int, input().split())
S = input().strip()
L = len(S)

ans = 0
for i in range(L):
    for j in range(i, L):
        s = S[i: j+1]
        if int(s) % P == 0:
            ans += 1

print(ans)



### FIXED CODE ###

N, P = map(int, input().split())
S = input().strip()[::-1]

if P in [2, 5]:
    ans = 0
    for r in range(N):
        if int(S[r]) % P == 0:
            ans += N - r
    print(ans)
    exit()

d = [0] * (N + 1)
ten = 1
for i in range(N):
    a = int(S[i]) * ten % P
    d[i+1] = (d[i] + a) % P
    ten *= 10
    ten %= P

cnt = [0] * P
ans = 0
for i in range(N + 1):
    ans += cnt[d[i]]
    cnt[d[i]] += 1

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

n = int(input())
s = input()
r = 0
g = 0
b = 0
for letter in s:
    if letter == "R":
        r +=1
    elif letter == "G":
        g +=1
    elif letter == "B":
        b +=1
total = r * g * b
subs = 0
for i in range(n):
    for j in range(i + 1, n):
        k = 2 * j - i
        if k <= n - 1:
            if s[i] == s[j]:
                continue
            elif s[j] == s[k]:
                continue
            elif s[k] == s[i]:
                continue
            else:
                subs += 1
        else:
            continue
ans = total - subs
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
r = 0
g = 0
b = 0
for letter in s:
    if letter == "R":
        r +=1
    elif letter == "G":
        g +=1
    elif letter == "B":
        b +=1
total = r * g * b
subs = 0
for i in range(n):
    for j in range(i + 1, n):
        k = 2 * j - i
        if k <= n - 1:
            if s[i] == s[j]:
                continue
            elif s[j] == s[k]:
                continue
            elif s[k] == s[i]:
                continue
            else:
                subs += 1
        else:
            break
ans = total - subs
print(ans)
### BUGGY CODE ###

H, W, M = map(int, input().split())

bomb = []
row = [0] * H
column = [0] * W

for i in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    
    bomb.append([h, w])
    
    row[h] += 1
    column[w] += 1
    
row_max = max(row)
col_max = max(column)

r_check = []
c_check = []
for i in range(H):
    if row[i] == row_max:
        r_check.append(i)

for i in range(W):
    if column[i] == col_max:
        c_check.append(i)

ans = 0
flg = False
for r in r_check:
    if flg:
        break
    for c in c_check:
        if [r, c] in bomb:
            ans = row[r] + column[c] - 1
        else:
            ans = row[r] + column[c]
            flg = True
            break

print(ans)

### FIXED CODE ###

H, W, M = map(int, input().split())

bomb = set()
row = [0] * H
column = [0] * W

for i in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    
    bomb.add((h, w))
    
    row[h] += 1
    column[w] += 1
    
row_max = max(row)
col_max = max(column)

r_check = []
c_check = []
for i in range(H):
    if row[i] == row_max:
        r_check.append(i)

for i in range(W):
    if column[i] == col_max:
        c_check.append(i)

num = len(r_check) * len(c_check)

ans = row_max + col_max - 1
flg = False
if M < num:
    ans += 1
else:
    for r in r_check:
        if flg:
            break
        for c in c_check:
            if not (r, c) in bomb:
                ans += 1
                flg = True
                break

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

n, q = map(int,input().split())
s = input()
for i in range(q):
    a,b = map(int,input().split())
    print(s[a-1:b].count("AC"))

### FIXED CODE ###

n, q = map(int,input().split())
s = list(input())
t = [0]*(n)
j = 0
for j in range(n-1):
    if s[j]=="A" and s[j+1]=="C":
        t[j+1]=t[j]+1
    else:
        t[j+1]=t[j]
i = 0
for i in range(q):
    a,b = map(int,input().split())
    print((t[b-1])-(t[a-1]))
### BUGGY CODE ###

import collections

def c2c(n):
    return n*(n-1)//2

N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
c = c.most_common()
d = {}
for i in range(len(c)):
    d2 = 0
    for j in range(len(c)):
        if i==j:
            d2+=c2c(c[j][1]-1)
        else:
            d2+=c2c(c[j][1])
    d[c[i][0]]=d2

for i in range(len(A)):
    print(d[A[i]])

### FIXED CODE ###

import collections

def c2c(n):
    return n*(n-1)//2

N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
c_l = list(c.values())
d2 = sum([c2c(i) for i in c_l])
#print(d2)

for i in range(len(A)):
    print(d2-(c[A[i]]-1))
### BUGGY CODE ###

INF=10**9+7
L=[int(i) for i in input().split()]
x=[int(i) for i in input().split()]
y=[int(i) for i in input().split()]
x.sort()
y.sort()

X=[x[i+1]-x[i] for i in range(L[0]-1)]
Y=[y[i+1]-y[i] for i in range(L[1]-1)]

usingX=[0 for i in range(L[0])]
usingY=[0 for i in range(L[1])]

ansx=0
for i in range(1,L[0]+1):#width
	for j in range(L[0]-i):#starting
		for k in range(i):#block
			ansx+=X[j+k]
			#print(i,j,k)
ansy=0
for i in range(1,L[1]+1):
	for j in range(L[1]-i):
		for k in range(i):
			ansy+=Y[j+k]
print(ansx*ansy%INF)

#print(ansx)
#print(ansy)

### FIXED CODE ###

INF=10**9+7
L=[int(i)-1 for i in input().split()]
x=[int(i)   for i in input().split()]
y=[int(i)   for i in input().split()]
x.sort()
y.sort()

X=[x[i+1]-x[i] for i in range(L[0])]
Y=[y[i+1]-y[i] for i in range(L[1])]

usingX=[0 for i in range(L[0])]
usingY=[0 for i in range(L[1])]

if L[0]%2==0:
	for i in range(L[0]):
		temp=min(i,L[0]-i-1)
		temp+=1
		usingX[i]+=int(temp*(temp+1)/2)
		#print(usingX)
		usingX[i]+=temp*int(L[0]/2-temp)
		#print(usingX)
		usingX[i]*=2
		#print()
else:
	for i in range(L[0]):
		temp=min(i,L[0]-i-1)
		temp+=1
		usingX[i]+=int(temp*(temp+1)/2)
		usingX[i]+=temp*int((L[0]-1)/2-temp)
		usingX[i]*=2
		
		usingX[i]+=temp
	#temp=int((L[0]-1)/2)
	#usingX[temp]-=(temp+1)*2


if L[1]%2==0:
	for i in range(L[1]):
		temp=min(i,L[1]-i-1)
		temp+=1
		usingY[i]+=int(temp*(temp+1)/2)
		#print(usingY)
		usingY[i]+=temp*int(L[1]/2-temp)
		#print(usingY)
		usingY[i]*=2
		#print()
else:
	for i in range(L[1]):
		temp=min(i,L[1]-i-1)
		temp+=1
		usingY[i]+=int(temp*(temp+1)/2)
		usingY[i]+=temp*int((L[1]-1)/2-temp)
		usingY[i]*=2
		
		usingY[i]+=temp
	#temp=int((L[1]-1)/2)
	#usingY[temp]-=(temp+1)*2	

#print(usingX)
#print(usingY)
for i in range(L[0]):
	X[i]*=usingX[i]
for j in range(L[1]):
	Y[j]*=usingY[j]
ans=sum(X)*sum(Y)
print(ans%INF)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
from itertools import accumulate
from functools import lru_cache
sys.setrecursionlimit(10**8)
INF = float("inf")


def solve(N: int, a: "List[int]"):

    acc = [0]+list(accumulate(a))

    @lru_cache(maxsize=None)
    def rec(l, r):
        if l == r:
            return 0

        wa = acc[r+1]-acc[l]
        ans = INF
        for k in range(l, r):
            ans = min(rec(l, k) + rec(k+1, r), ans)
        return ans + wa

    print(rec(0, N-1))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from itertools import accumulate
import functools
sys.setrecursionlimit(10**8)
INF = float("inf")


def solve(N: int, a: "List[int]"):

    dp = [[-1]*N for _ in range(N)]
    acc = [0]+list(accumulate(a))

    def rec(l, r):
        if dp[l][r] > 0:
            return dp[l][r]
        if l == r:
            return 0

        wa = acc[r+1]-acc[l]
        ans = INF
        for k in range(l, r):
            ans = min(rec(l, k) + rec(k+1, r), ans)
        dp[l][r] = ans + wa
        return dp[l][r]

    print(rec(0, N-1))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


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

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

ans = 1
for i in a_list:
  ans *= i

if ans > 10**18:
  ans = -1
    
print(ans)

### FIXED CODE ###

n = int(input())
a_list = sorted([int(i) for i in input().split()])

if a_list[0] == 0:
  print(0)
else:
  ans = 1
  for i in a_list:
    ans *= i
    if ans > 10**18:
      ans = -1
      break
  print(ans)
### BUGGY CODE ###

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

b=[0]*20
c,l,r=0,0,0
for l in range(N):
  r=l
  b=[0]*20
  while r<N:
    for i in range(20):
      b[i]+=1 if (A[r]&2**i)!=0 else 0
    if max(b)<2:
      r+=1
      c+=1
    else:
      break
print(c)


### FIXED CODE ###

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

r,S,R=0,0,0

for l in range(N):
  while r<N:
    if S&A[r]==0:
      S|=A[r]
      r+=1
    else:
      break
  R+=r-l
  S&=~A[l]

print(R)
### BUGGY CODE ###

class UnionFind():
    #https://note.nkmk.me/python-union-find/ 
    #note.nkmk.me  2019-08-18 
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない
N,M = map(int, input().split())
G =UnionFind(N)
for i in range(M):
    a,b = map(int, input().split())
    #a,b =min(a,b),max(a,b)
    G.union(a-1,b-1)
members =G.all_group_members()

ans =0
for i in members.values():
    ans =max(ans,len(i))
print(ans)

### FIXED CODE ###

class UnionFind():
    #https://note.nkmk.me/python-union-find/ 
    #note.nkmk.me  2019-08-18 
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない
N,M = map(int, input().split())
G =UnionFind(N)
ans =0
for i in range(M):
    a,b = map(int, input().split())
    #a,b =min(a,b),max(a,b)
    G.union(a-1,b-1)
    ans =max(ans,G.size(a-1))
if M ==0:
    print(1)
else:
    print(ans)
### BUGGY CODE ###

N = int(input())

sum = 0
for i in range(N):
    sum += i

print(sum)


### FIXED CODE ###

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