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

import numpy as np
N = int(input())
S = str(input())

num = np.zeros((3,N))
if S[N-1] == 'R':
    num[0][N-1] += 1
elif S[N-1] == 'G':
    num[1][N-1] += 1
else:
    num[2][N-1] += 1
    
for i in range(2,N+1):
    num[0][-i] = num[0][-i+1]
    num[1][-i] = num[1][-i+1]
    num[2][-i] = num[2][-i+1]
    if S[-i] == 'R':
        num[0][-i] += 1
    elif S[-i] == 'G':
        num[1][-i] += 1
    else:
        num[2][-i] += 1

ans = 0
for i in range(N):
    for j in range(i+1,N-1):
        if S[i] != S[j]:
            if S[i] != 'R' and S[j] != 'R':
                ans += num[0][j+1]
                if 2*j - i < N:
                    if S[2*j - i] == 'R':
                        ans -= 1
                        
            if S[i] != 'G' and S[j] != 'G':
                ans += num[1][j+1]
                if 2*j - i < N:
                    if S[2*j - i] == 'G':
                        ans -= 1
                        
            if S[i] != 'B' and S[j] != 'B':
                ans += num[2][j+1]
                if 2*j - i < N:
                    if S[2*j - i] == 'B':
                        ans -= 1
                    
print(int(ans)) 

### FIXED CODE ###

N = int(input())
S = str(input())
R,G,B = 0,0,0
for i in range(N):
    if S[i] == 'R':
        R += 1
    elif S[i] == 'B':
        B += 1
    else:
        G += 1

exc = 0
for j in range(1,N-1):
    num = 1
    while 0 <= j-num and j+num < N:
        if S[j-num] != S[j+num] and  S[j-num] != S[j] and  S[j] != S[j+num]:
            exc += 1
        num += 1

print(int(R*B*G - exc))
### BUGGY CODE ###

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int
D = dict()

def powmod(a, n, m):
    L = [1 for _ in range(n+1)]
    for i in range(n):
        L[i+1] = L[i] * a % m
    return L

def solve(L: str):
    p = len(L)
    pm = powmod(3, p, MOD)
    
    D['0'] = 1
    D['1'] = 3
    s = ''
    for i, c in enumerate(L[::-1]):
        s_next = c + s
        if len(s_next) == 1:
            s = s_next
            continue
        if c == '0':
            D[s_next] = D[s]
        else:
            D[s_next] = (pm[i] + D[s] * 2) % MOD
        s = s_next
    print(D[L])
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = next(tokens)  # type: int
    solve(L)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def powmod(a, n, m):
    L = [1 for _ in range(n+1)]
    for i in range(n):
        L[i+1] = L[i] * a % m
    return L

def solve(L: str):
    p = len(L)
    pm = powmod(3, p, MOD)
    
    s = ''
    for i, c in enumerate(L[::-1]):
        if i == 0:
            if c == '1':
                res = 3
            else:
                res = 1
            continue
        
        if c == '0':
            res = res
        else:
            res = (pm[i] + res * 2) % MOD
    print(res)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    L = next(tokens)  # type: int
    solve(L)

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

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

ab = [list(map(int, input().split())) for _ in range(M)]
cd = [list(map(int, input().split())) for _ in range(K)]

lstab = [[] for _ in range(N)]
lstcd = [[] for _ in range(N)]
ans = [[] for _ in range(N)]

for a,b in ab:
    lstab[a-1].append(b-1)
    lstab[b-1].append(a-1)

    
for c,d in cd:
    lstcd[c-1].append(d-1)
    lstcd[d-1].append(c-1)

groups = []

for i in range(N):
    jdg = False
    for grp in groups:
        if i in grp:
            jdg = True
            break
    if jdg: break
    
    temp = [i]
    visited = [i]

    while temp:
        x = temp.pop()
        for y in lstab[x]:
            if y in visited:continue
            temp.append(y)
            visited.append(y)
    groups.append(visited)

ans = [0]*N
for grp in groups:
    for j in grp:
        ans[j] = len(set(grp) - {j} - set(lstcd[j]) - set(lstab[j]))

print(*ans)


### FIXED CODE ###

import sys
from collections import Counter
input = sys.stdin.readline

N, M, K = map(int, input().split())
 
lstab = [[] for _ in range(N)]

for _ in range(M):
    a, b = map(int, input().split())
    lstab[a-1].append(b-1)
    lstab[b-1].append(a-1)

visited = [0] * N
cnt = 0

for i in range(N):
    if visited[i] != 0: continue
    temp = [i]
    cnt += 1
    visited[i] = cnt
 
    while temp:
        x = temp.pop()
        for y in lstab[x]:
            if visited[y] != 0:continue
            temp.append(y)
            visited[y] = cnt

numcd = [ 0 ] * N
for _ in range(K):
    c, d = map(int, input().split())
    if visited[c-1] == visited[d-1]:
        numcd[c-1] += 1
        numcd[d-1] += 1    
    
ans = [0] * N
cnt = Counter(visited)

for i in range(N):
    ans[i] = cnt[visited[i]] - 1 - len(lstab[i]) - numcd[i]
 
print(*ans)
### BUGGY CODE ###

# coding:utf-8
import fractions


def main():
    N = int(input())
    num = list(map(int, input().split()))
    # num.sort()
    # print(num)
    # print(num[0:0])
    gcd = 0
    for i in range(len(num)):
        temp_list = num[0:i]+num[i+1:]
        temp_gcd = temp_list[0]
        for i in temp_list:
            temp_gcd = fractions.gcd(temp_gcd, i)
        # temp_gcd = functools.reduce(math.gcd, temp_list)
        if temp_gcd > gcd:
            gcd = temp_gcd
    print(gcd)
    # ans = 0
    # print()


if __name__ == "__main__":
    main()


### FIXED CODE ###

# coding:utf-8
import fractions


def main():
    N = int(input())
    # N = 10 ** 5
    num = list(map(int, input().split()))
    # num = list(range(1, 10**5 + 1))
    # num.sort()
    gcd = 0
    gcd_list_front = []
    gcd_list_back = []
    gcd_list_front.append(num[0])
    gcd_list_back.append(num[-1])

    for i in range(1, N-1):
        gcd_list_front.append(fractions.gcd(gcd_list_front[i-1], num[i]))
        gcd_list_back.append(fractions.gcd(gcd_list_back[i-1], num[-i-1]))

    gcd_list_back.reverse()
    # print(gcd_list_front)
    # print(gcd_list_back)

    gcd = max(gcd_list_back[0], gcd_list_front[-1])

    for i in range(0, N-2):
        # print(gcd_list_front[i], gcd_list_back[i+1])
        temp_gcd = fractions.gcd(gcd_list_front[i], gcd_list_back[i+1])
        if temp_gcd > gcd:
            gcd = temp_gcd

    print(gcd)
    # ans = 0
    # print()


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

import fractions
from functools import reduce
import sys
sys.setrecursionlimit(10**9)
mod = 10**9+7

N = int(input())
A = list(map(int,input().split()))
fact = [1]*(10**7+10)
rfact = [1]*(10**7+10)

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)
def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

value = lcm_list(A)
ans = 0
for i in range(N):
    ans += value*pow(A[i], mod-2, mod)%mod
print(ans%mod)

### FIXED CODE ###

import fractions
from functools import reduce
# Python3 program to compute LCM of 
# array elements modulo M
MAX = 10**6+1
mod = 1000000007
prime = [0 for i in range(MAX)] 
max_map = dict() 
# function to return a^n 
def power(a, n):
	if n == 0: 
		return 1
	p = power(a, n // 2) % mod
	p = (p * p) % mod
	if n & 1: 
		p = (p * a) % mod
	return p 

# function to find the smallest prime
# factors of numbers upto MAX
def sieve(): 
	prime[0], prime[1] = 1, 1
	for i in range(2, MAX): 
		if prime[i] == 0: 
			for j in range(i * 2, MAX, i): 
				if prime[j] == 0: 
					prime[j] = i 
			prime[i] = i 

# function to return the LCM modulo M 
def lcmModuloM(arr, n): 
	for i in range(n): 
		num = arr[i] 
		temp = dict() 
		# temp stores mapping of prime factors 
		# to its power for the current element 
		while num > 1:
			# factor is the smallest prime
			# factor of num
			factor = prime[num]
			# Increase count of factor in temp
			if factor in temp.keys():
				temp[factor] += 1
			else:
				temp[factor] = 1
			# Reduce num by its prime factor
			num = num // factor
		for i in temp:
			# store the higest power of every prime
			# found till now in a new map max_map
			if i in max_map.keys():
				max_map[i] = max(max_map[i], temp[i])
			else: 
				max_map[i] = temp[i]
	ans = 1
	for i in max_map:
		ans = (ans * power(i, max_map[i])) % mod
	return ans
# Driver code
sieve()
X = int(input())
A = list(map(int,input().split()))
N = max(A)
value = lcmModuloM(A, X)
ans = 0
for i in range(X):
    ans += value*pow(A[i], mod-2, mod)%mod
print(ans%mod)
### BUGGY CODE ###

N = int(input())
b = list(map(int, input().split()))
s = list(set(b))

ans = []

def f(q, i, x):
  cnt = 0
  if i > N:
    if b == q:
      ans.append(x)
    return
  for j in s:
    if j > i:
      continue
    f(q[:j-1] + [j] + q[j-1:], i+1, x + [j])
  return

f([], 1, [])

if len(ans) == 0:
  print(-1)
else:
  for v in ans[0]:
    print(v)

### FIXED CODE ###

import copy
N = int(input())
b = list(map(int, input().split()))
ans = []
while len(b) > 0:
  n = len(b)
  f = False
  for i in range(n):
    if b[n-i-1] == n-i:
      ans.append(b.pop(n-i-1))
      f = True
      break
  if not f:
    print('-1')
    break
  if len(ans) == N:
    ans.reverse()
    for v in ans:
      print(v)
    break
### BUGGY CODE ###

import itertools
s = input()

a = [i for i in range(len(s))]
c = 0
for v in itertools.combinations(a,2):
	x,y = v[0],v[1]
	if y-x < 4:
		continue
	#print (s[x:y+1],x,y)
	if int(s[x:y+1]) %2019 == 0:
		c += 1
print (c)



### FIXED CODE ###

s = input()

c = [0 for i in range(2019)]
c[0] = 1
mod = 2019
d = 1
x = 0
for i,j in enumerate(s[::-1]):
	x = (x + int(j)*pow(10,i,mod))%mod
	c[x] += 1

ans = 0
for i in range(2019):
	ans += (c[i]*(c[i]-1))//2
print (ans)
### BUGGY CODE ###

def main():
    import math
    a, b, n = map(int, input().split())
    ans = 0
    if n > 10 ** 10:
        for x in range(n, 10 ** 8, -1):
            fx = math.floor(a * x / b) - math.floor(x / b) * a
            #print(fx)
            if ans < fx:
                ans = fx
            if ans > fx + 10 ** 3:
                #exit()
                pass

    elif n > 10 ** 8:
        for x in range(n, 10**6 , -1):
            fx = math.floor(a * x / b) - math.floor(x / b) * a
            #print(fx)
            if ans < fx:
                ans = fx
            if ans > fx + 10 ** 3:
                #exit()
                pass

    elif n > 10 ** 6:
        for x in range(n, 10**4 , -1):
            fx = math.floor(a * x / b) - math.floor(x / b) * a
            #print(fx)
            if ans < fx:
                ans = fx
            if ans > fx + 10 ** 3:
                #exit()
                pass
    else: 
        for x in range(n, 0, -1):
            fx = math.floor(a * x / b) - math.floor(x / b) * a
            #print(fx)
            if ans < fx:
                ans = fx
            if ans > fx + 10 ** 3:
                #exit()
                pass

    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###


def main():
    import math
    a, b, n = map(int, input().split())
    if n >= b:
        ans = math.floor(a * (b-1)/b)
    else:
        ans = math.floor(a * n / b)
    
    print(ans)
    




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

def main():
    N = int(input())
    a = map(int, input().split())
    single = double = triple = 0
    for sushi in a:
        if sushi == 1:
            single += 1
        elif sushi == 2:
            double += 1
        elif sushi == 3:
            triple += 1
    dp = [[[0 for i in range(1+single+double+triple-j-k)]
           for j in range(double + triple + 1 - k)] for k in range(triple + 1)]
    for k in range(triple+1):
        for j in range(double + triple + 1-k):
            for i in range(1+single+double+triple-j-k):
                if i == 0 and j == 0 and k == 0:
                    continue
                first = second = third = 0
                if i-1 >= 0 and j >= 0 and k >= 0:
                    first = dp[k][j][i-1]
                if i+1 >= 0 and j-1 >= 0 and k >= 0:
                    second = dp[k][j - 1][i+1]
                if i >= 0 and j+1 >= 0 and k-1 >= 0:
                    third = dp[k-1][j + 1][i]
                dp[k][j][i] = (first*i + second * j +
                               third * k + N) / (i + j + k)
    print(dp[triple][double][single])


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    N = int(input())
    a = map(int, input().split())
    single = double = triple = 0
    for sushi in a:
        if sushi == 1:
            single += 1
        elif sushi == 2:
            double += 1
        elif sushi == 3:
            triple += 1
    dp = [[[0 for i in range(1+single+double+triple-j-k)]
           for j in range(double + triple + 1 - k)] for k in range(triple + 1)]
    for k in range(triple+1):
        for j in range(double + triple + 1-k):
            for i in range(1+single+double+triple-j-k):
                if i == 0 and j == 0 and k == 0:
                    continue
                first = second = third = 0
                if i-1 >= 0 and j >= 0 and k >= 0:
                    first = dp[k][j][i-1]
                if i+1 >= 0 and j-1 >= 0 and k >= 0:
                    second = dp[k][j - 1][i+1]
                if i >= 0 and j+1 >= 0 and k-1 >= 0:
                    third = dp[k-1][j + 1][i]
                dp[k][j][i] = (first*i + second * j +
                               third * k + N) / (i + j + k)
    print(dp[triple][double][single])


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

N = int(input())
def isPrime(n):
  if n < 2:
    return False
  i = 2
  while i*i <= n:
    if n%i == 0:
      return False
    i += 1
  return True
if isPrime(N):
  print(len(str(N)))
else:
  ans = float("inf")
  for i in range(1,N+1):
    if N % i == 0:
      if i >= N // i:
        ans = min(ans,len(str(i)))
      else:
        ans = min(ans,len(str(N // i)))
  print(ans)    

### FIXED CODE ###

import math
N = int(input())
def isPrime(n):
  if n < 2:
    return False
  i = 2
  while i*i <= n:
    if n%i == 0:
      return False
    i += 1
  return True
if isPrime(N):
  print(len(str(N)))
else:
  ans = float("inf")
  i = 1
  while i <= math.sqrt(N):
    if N % i == 0:
      if i >= N // i:
        ans = min(ans,len(str(i)))
      else:
        ans = min(ans,len(str(N // i)))
    i += 1
  print(ans)
### BUGGY CODE ###

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

for i in range(len(A)):
  print(A.index(i+1)+1, end =' ')

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
lst = [0]*len(A)
cnt = 1

for i in A:
  lst[i-1] = str(cnt)
  cnt += 1

print(' '.join(lst))
### BUGGY CODE ###

r, g, b, n = map(int, input().split())
ans = 0

l = [r, g, b]
l.sort(reverse=True)
for i in range(n+1):
    if l[0]*i > n:
        break
    for j in range(n+1):
        if l[0]*i + l[1]*j > n:
            break
        elif (n-(l[0]*i + l[1]*j)) % l[2] == 0:
            ans += 1
print(ans)

### FIXED CODE ###

r, g, b, n = map(int, input().split())
ans = 0

l = [r, g, b]
l.sort(reverse=True)
a = n // l[0]
for i in range(a+1):
    for j in range(n+1):
        if l[0]*i + l[1]*j > n:
            break
        elif (n-(l[0]*i + l[1]*j)) % l[2] == 0:
            ans += 1
print(ans)
### BUGGY CODE ###

n, k, q = map(int, input().split())
points = [None for _ in range(n + 1)]
for i in range(1, n+1):
    points[i] = k
for j in range(q):
    answer = int(input())
    for i in range(1, n + 1):
        if i == answer:
            continue
        else:
            points[i] -= 1
for i in range(1, n+1):
    if points[i] > 0:
        print("Yes")
    else:
        print('No')

### FIXED CODE ###

n, k, q = map(int, input().split())
points = [0 for _ in range(n + 1)]
for i in range(q):
    answer = int(input())
    points[answer] += 1
for i in range(1, n + 1):
    if (points[i] + k - q) > 0:
        print("Yes")
    else:
        print('No')
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)
N, Q = map(int, input().split())
graph = [[] for _ in range(N)]
point = [0]*N
for i in range(N-1):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
for i in range(Q):
    p, x = map(int, input().split())
    point[p-1] += x
def dfs(s,parent):
    for i in graph[s]:
        if i == parent:
            continue
        point[i] += point[s]
        dfs(i,s)
dfs(0,-1)
print(*point)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
N, Q = map(int, input().split())
graph = [[] for _ in range(N)]
point = [0]*N
for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)
for i in range(Q):
    p, x = map(int, input().split())
    point[p-1] += x
def dfs(s,parent):
    for i in graph[s]:
        if i == parent:
            continue
        point[i] += point[s]
        dfs(i,s)
dfs(0,-1)
print(*point)
### BUGGY CODE ###

n= int(input())
a=list(map(int, input().split()))
ans=0
a.sort(reverse=True)
for i in range(n):
    if a[i]:
        bi=format(a[i], 'b')
        x=2**len(bi)-a[i]
        if x==a[i] and a.count(x)>1:
            ans+=1
            a[i]=None
            a[a.index(x)]=None
        elif x in a and x!=a[i]:
            ans+=1
            a[a.index(x)]=None
            a[i]=None
print(ans)


### FIXED CODE ###

import collections
import bisect
n= int(input())
a=list(map(int, input().split()))
c=collections.Counter(a)
ans=0
des=sorted(a,reverse=True)
# asc=sorted(a)

for i in des:
    if c[i]>0:
        bi=format(i, 'b')
        x=2**len(bi)-i
        c[i]-=1
        if c[x]>0:
            c[x]-=1
            ans+=1
print(ans)
### BUGGY CODE ###

s=input()
N=len(s)
t=input()
M=len(t)

alphabetlist=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
def al(str):
    return alphabetlist.index(str)+1

dp=[[0 for i in range(0,M)] for i in range(0,N)]

firsts=N
for i in range(0,N):
    if s[i]==t[0]:
        firsts=i
        break

firstt=M
for i in range(0,M):
    if t[i]==s[0]:
        firstt=i
        break

for i in range(0,N):
    if i>=firsts:
        dp[i][0]=al(t[0])

for i in range(0,M):
    if i>=firstt:
        dp[0][i]=al(s[0])

for i in range(1,N):
    for j in range(1,M):
        if s[i]==t[j]:
            dp[i][j]=dp[i-1][j-1]*100+al(s[i])
        else:
            if dp[i][j-1]>dp[i-1][j]:
                dp[i][j]=dp[i][j-1]
            else:
                dp[i][j]=dp[i-1][j]

a=dp[N-1][M-1]
ans=[]
while a!=0:
    i=a%100
    ans.append(alphabetlist[i-1])
    a//=100

ans=ans[::-1]
print(''.join(ans))

### FIXED CODE ###

s=input()
N=len(s)
t=input()
M=len(t)

alphabetlist=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
def al(str):
    return alphabetlist.index(str)+1

dp=[[0 for i in range(0,M+1)] for i in range(0,N+1)]

for i in range(0,N):
    for j in range(0,M):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            if dp[i+1][j]>dp[i][j+1]:
                dp[i+1][j+1]=dp[i+1][j]
            else:
                dp[i+1][j+1]=dp[i][j+1]

ans=[]
i=N
j=M
while i>0 and j>0:
    if dp[i][j]==dp[i-1][j]:
        i-=1
    elif dp[i][j]==dp[i][j-1]:
        j-=1
    else:
        ans.append(s[i-1])
        i-=1
        j-=1

ans=ans[::-1]
print(''.join(ans))
### BUGGY CODE ###

import numpy as np
n=int(input())
l=np.array(list(map(int,input().split())))
r=np.arange(1,n)-l[1:]
ans=0
for i in range(n):
  ans+=np.count_nonzero(r[i:]==l[i]+i)
print(ans)  

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
r=[0]*(n-1)
t=[0]*(n)
dr={}
dt={l[0]:[0]}
for i in range(1,n):
  x=i-l[i]
  y=i+l[i]
  if x in dr:
    dr[x].append(i)
  else:
    dr[x]=[i]
  if y in dt:
    dt[y].append(i)
  else:
    dt[y]=[i]
ans=0
for x in dr.keys():
  if x>0 and x in dt:
    y=dr[x]
    z=dt[x]
    ans+=len(z)*len(y)
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(100001)

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

dp = [0] * N
parent = [[] for _ in range(N)]
child = [False] * N

for _ in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    parent[y].append(x)
    child[x] = True

def func(node):
    for i in parent[node]:
        if dp[i] <= dp[node]:
            dp[i] = dp[node] + 1
            func(i)

for i, b in enumerate(child):
    if not b:
        func(i)

print(max(dp))

### FIXED CODE ###

import sys
sys.setrecursionlimit(100001)

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

dp = [0] * N
g = [[] for _ in range(N)]

for _ in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    g[x].append(y)

def dfs(node):
    if dp[node] > 0:
        return dp[node]
    mx = 0
    for i in g[node]:
        a = dfs(i) + 1
        if mx < a:
            mx = a
    dp[node] = mx
    return mx

ans = 0
for i in range(N):
    if dp[i] == 0:
        ans = max(ans, dfs(i))

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

N = int(input())
A=[int(i) for i in input().split()]
S=[0]
S.append(A[0])
for i in range(1,N):
    a = S[-1] + A[i]
    S.append(a)
T =[0]
T.append(A[0])
for i in range(1,N):
    a = T[-1]^A[i]
    T.append(a)
ans = 0
for r in range(1,N+1):
    for l in range(r):
        if S[r]-S[l] == T[r]^T[l]:
            ans+=1
print(ans)

### FIXED CODE ###

N = int(input())
A=[int(i) for i in input().split()]
L = []
asum=A[0]
axor=A[0] 
i=0
j=0
while (i<N):
    while (asum ==axor) and (j<N-1):
        j = j+1
        asum += A[j]
        axor ^= A[j]
    if (j<N-1):
        L.append((i,j-1))
        asum -= A[i]
        axor ^= A[i] 
        i += 1
    elif (asum ==axor):
        L.append((i,N-1))
        i += 1 
    else:
        L.append((i,j-1))
        asum -= A[i]
        axor ^= A[i] 
        i += 1
ans = 0
for l,r in L:
    ans += r-l+1
print(ans)
### BUGGY CODE ###

A,B,C,K = map(int,input().split())

sum = 0
for i in range(A+1):
  for j in range(B+1):
    for l in range(C+1):
      #print (i)
      #print (j)
      #print (l)
      #print("-----")
      if 1*i +0*j+(-1)*l>=sum and i+j+l ==K:
        sum = 1*i +0*j+(-1)*l
print (sum)

### FIXED CODE ###

A,B,C,K = map(int,input().split())

koa = 0
if A<K:
  koa = A
else :
  koa = K
kob = 0
if B<K-koa:
  kob = B
else :
  kob = K-koa
#print (koa)
#print (kob)
sum = koa+0*kob+(K-(koa+kob))*-1
print (sum)
### BUGGY CODE ###

n = int(input())
s = [int(x) for x in input().split()]
q = int(input())
t = [int(x) for x in input().split()]
a = [x for x in t if x in s]
print(len(a))


### FIXED CODE ###

def binarySearch(array, key):
    left = 0
    right = len(array)
    while left < right:
        mid = int((left + right) / 2)
        if key == array[mid]:
            return True
        elif key > array[mid]:
            left = mid + 1
        elif key < array[mid]:
            right = mid
        else:
            print("ERROR")
    return False


n = int(input())
s = [int(x) for x in input().split()]
q = int(input())
t = [int(x) for x in input().split()]
a = [x for x in t if binarySearch(s, x)]
print(len(a))
### BUGGY CODE ###

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

# 2で割るor3倍にする
# 全部3倍はダメで、操作後は整数でないとダメ。

en = aList
count = 0
while True:
    cache = []
    for x in en:
        if x % 2 == 0:
            if len(cache) > 0:
                cache.append(int(3*x))
            else:
                cache.append(x // 2)

    if len(cache) > 0:
        count += 1
    else:
        break
    en = cache

print(count)

### FIXED CODE ###

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

def calc(x, cache):
    if x % 2 == 0:
        return calc(x//2, cache+1)
    else:
        return cache

count = 0
for x in aList:
    if x % 2 == 0:
        count += calc(x, 0)

print(count)