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

N = int(input())
XL = []
flag = [0]*N
for i in range(N):
	xl = list(map(int,input().split()))
	XL.append(xl)
XL.sort()
for i in range(N-1):
	for j in range(i+1,N-i):
		if(flag[i] == 0 ):
			if(XL[i][0]+XL[i][1]>=XL[j][0]):
				flag[j]=1
			else:
				break
sum = 0
for i in range(N):
	sum+=flag[i]
print(N-sum)

### FIXED CODE ###

N = int(input())
XL = []
for i in range(N):
	x,l = map(int,input().split())
	S = x + l
	T = x - l
	XL.append((S,T))
XL.sort()
#print(XL)

ans = 0

min = -float("inf")
for s,t in XL:
	if min <= t:
		ans+=1
		min = s
print(ans)
### BUGGY CODE ###

n,m=map(int,input().split())
root_kouho=set(list(range(n)))
ki=[[] for _ in range(n)]
for i in range(n-1+m):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  root_kouho.discard(b)
  ki[a].append(b)
root=root_kouho.pop()
from collections import deque
p=[-1]*n
p[root]=0
todo=deque([[root,-1]])
ans=[-1]*n
ans[root]=0
#todo=[[root,-1]]
while todo:
  t,p=todo.popleft()
  for li in ki[t]:
    if li!=p:
      ans[li]=t+1
      todo.append([li,t])
print(*ans,sep='\n')

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
n,m=map(int,input().split())
root_kouho=set(list(range(n)))
leaf=set(list(range(n)))
ki=[[] for _ in range(n)]
for i in range(n-1+m):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  root_kouho.discard(b)
  leaf.discard(a)
  ki[b].append(a)
root=root_kouho.pop()
ans=[-1]*n
dp=[-1]*n # 根までの最長距離
ans[root]=0
dp[root]=0
def func(v):
  if dp[v]>=0:
    return dp[v]
  else:
    ret=-1
    for nv in ki[v]:
      tmp=func(nv)
      if ret<tmp:
        ret=tmp
        ans[v]=nv+1
    dp[v]=ret+1
    return ret+1
while leaf:
  l=leaf.pop()
  func(l)
print(*ans,sep='\n')
#print(dp)
### BUGGY CODE ###

n = int(input())
data = [int(x) for x in input().split()]
data_dict = {}

# ボールに書かれた整数を集計する
for x in data:
    if x in data_dict.keys():
        data_dict[x] = data_dict[x] + 1
    else:
        data_dict[x] = 1

#pdb.set_trace()

for k in range(n):
    data_dict_copy = data_dict.copy()
    # k番目のボールの個数を減らす
    data_dict_copy[data[k]] = data_dict_copy[data[k]] - 1

    answer = 0
    for x in data_dict_copy.values():
        answer += int(x*(x-1)/2)

    print(answer)

### FIXED CODE ###

n = int(input())
data = [int(x) for x in input().split()]
cnt = [0]*(n+1)

# ボールに書かれた整数を集計する
for x in data:
    cnt[x] += 1

total = int(sum([x*(x-1)/2 for x in cnt]))

for k in range(n):
    answer = total - cnt[data[k]] + 1
    print(answer)
### BUGGY CODE ###

p,n=map(int,input().split())
s=input()
for _ in range(n):
  l,r=map(int,input().split())
  print(s[(l-1):r].count('AC'))

### FIXED CODE ###

import re
n,q=map(int,input().split())
s=input()
a=[0]*n
b=[0]*n
i=[p.span()[0]for p in re.finditer('(AC){1,1}',s)]
c=0
for m in range(n):
  if c>=len(i):
    if m<n-1:a[m+1]=a[m]
    b[m]=b[m-1]
    continue
  if m==i[c]:
    if m>0:
      if m<n-1:a[m+1]=a[m]+1
      b[m]=b[m-1]+1
    else:
      a[m]=0
      a[m+1]=1
      b[m]+=1
    c+=1
  else:
    a[m+1]=a[m]
    b[m]=b[m-1]
for _ in range(q):
  l,r=map(int,input().split())
  if l>=2:
    print(a[r-1]-b[l-2])
  else:
    print(a[r-1])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6)

n = int(input())
ab = [[int(item) for item in input().split()] for _ in range(n-1)]

e = [[] for _ in range(n)]
for a, b in ab:
    e[a-1].append(b-1)
    e[b-1].append(a-1)

shortest = []
def get_path(start, end, par, path):
    global shortest
    if end in e[start]:
        shortest = path + [end]
        return True
    for item in e[start]:
        if item != par:
             get_path(item, end, start, path + [item])

def tree_count(start, par, a, b):
    count = 0
    for item in e[start]:
        if start == a and item == b:
            continue
        if start == b and item == a:
            continue
        if item != par:
            count += 1
            count += tree_count(item, start, a, b)
    return count

get_path(0, n-1, -1, [0])
cut_l = (len(shortest)-1) // 2
p = tree_count(0, -1, shortest[cut_l], shortest[cut_l+1])
q = n - p - 2 
if p > q:
    print("Fennec")
else:
    print("Snuke")

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

n = int(input())
e = [[] for _ in range(n)]

for i in range(n-1):
    a, b = [int(item) for item in input().split()]
    e[a-1].append(b-1)
    e[b-1].append(a-1)

shortest = []
def get_path(start, end, par):
    if end in e[start]:
        shortest.append(end)
        return True
    for item in e[start]:
        if item != par:
             if get_path(item, end, start):
                 shortest.append(item)
                 return True

def tree_count(start, par, a, b):
    count = 0
    for item in e[start]:
        if start == a and item == b:
            continue
        if start == b and item == a:
            continue
        if item != par:
            count += 1
            count += tree_count(item, start, a, b)
    return count

get_path(0, n-1, -1)
shortest.append(0)
shortest = shortest[::-1]
cut_l = (len(shortest)-1) // 2
p = tree_count(0, -1, shortest[cut_l], shortest[cut_l+1])
q = n - p - 2 
if p > q:
    print("Fennec")
else:
    print("Snuke")
### BUGGY CODE ###

import sys

n = input()
v = map(int, raw_input().split(' '))

if sum(v) % ((n * (n + 1)) / 2) != 0:
	print "NO"
	sys.exit()

while sum(v) > 0:
	biggest, second_biggest = 0, 0
	for i in range(n):
		if v[i] > v[biggest]:
			second_biggest = biggest
			biggest = i
		elif v[i] > v[second_biggest]:
			second_biggest = i

	times = (v[biggest] - v[second_biggest] + n - 1) / n

	for i in range(biggest, -1, -1):
		v[i] -= n - (biggest - i)
	for i in range(biggest + 1, n):
		v[i] -= i - biggest

	if min(v) < 0:
		print "NO"
		sys.exit()

if sum(v) == 0:
	print "YES"
else:
	print "NO"

### FIXED CODE ###

import sys

n = input()
v = map(int, raw_input().split(' '))
startHere = [0 for i in range(n)]

if sum(v) % ((n * (n + 1)) / 2) != 0:
	print "NO"
	sys.exit()

operations = sum(v) / ((n * (n + 1)) / 2)

for i in range(n):
	diff = v[(i + 1) % n] - v[i]

	startHere[i] = (operations - diff) / n

contribution = 0
gathered = 0

for i in range(n):
	v[i] -= contribution
	gathered += startHere[i % n]
	contribution += gathered

for i in range(n):
	v[i] -= contribution
	gathered -= startHere[i % n]
	contribution -= startHere[i % n] * n
	contribution += gathered

if min(startHere) >= 0 and sum(startHere) == operations and min(v) == 0 and max(v) == 0:
	print "YES"
else:
	print "NO"
### BUGGY CODE ###

N = int(input())
S = input()

a = N
for i in range(N):
    a = min(a, S[:i].count('W')+S[i+1:].count('E'))

print(a)


### FIXED CODE ###

N = int(input())
S = input()

a = S[1:].count('E')
W = 0
E = a
for i in range(1, N):
    if S[i - 1] == 'W':
        W += 1
    if S[i] == 'E':
        E -= 1
    a = min(W + E, a)

print(a)
### BUGGY CODE ###

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)


def prime_factorize(n):
    p = []
    while n % 2 == 0:
        if 2 not in p:
            p.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            if f not in p:
                p.append(f)
                n //= f
        else:
            f += 2
    if n != 1 and n not in p:
        p.append(n)
    return p


a, b = map(int, input().split())
q = prime_factorize(gcd(a, b))
# print(q)
print(len(q) + 1)


### FIXED CODE ###

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)


def prime_factorize(n):
    p = []
    while n % 2 == 0:
        if 2 not in p:
            p.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            if f not in p:
                p.append(f)
            n //= f
        else:
            f += 2
    if n != 1 and n not in p:
        p.append(n)
    return p


a, b = map(int, input().split())
q = prime_factorize(gcd(a, b))
# print(q)
print(len(q) + 1)
### BUGGY CODE ###

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

### FIXED CODE ###

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

n, *a = map(int, open(0).read().split())
[print(a.count(i)) for i in range(1, n + 1)]


### FIXED CODE ###

n, *a = map(int, open(0).read().split())
bt = [None] + [0] * n

for ai in a:
    bt[ai] += 1

for a in bt[1:]:
    print(a)
### BUGGY CODE ###


s = input()
n = len(s)
dp =[[0 for _ in range(13)] for _ in range(n+1)]
dp[0][0]=1

move = [[] for _ in range(13)]
for i in range(10):
    for j in range(13):
        move[(10*j+i)%13].append(j)

for i in range(n):
    if s[i]=="?":
        si = range(10)
        for mod,ex in enumerate(move):
            dp[i+1][mod] += sum([dp[i][x] for x in ex])
        
    else:
        si = int(s[i])
        for j in range(13):
            dp[i+1][(10*j+si)%13]+=dp[i][j]
    for j in range(13):
        dp[i+1][j] = dp[i+1][j]%(10**9+7)

print(dp[n][5])


### FIXED CODE ###


s = input()
n = len(s)
dp1 =[0 for _ in range(13)]
dp1[0]=1


move = [[] for _ in range(13)]

for i in range(10):
    for j in range(13):
        move[(10*j+i)%13].append(j)



for i in range(n):
    dp2 =[0 for _ in range(13)]
    if s[i]=="?":
        si = range(10)
        for mod,ex in enumerate(move):
            dp2[mod] += sum([dp1[x] for x in ex])
    else:
        si = int(s[i])
        for j in range(13):
            dp2[(10*j+si)%13]+=dp1[j]
    dp1 = [x%(10**9+7) for x in dp2] 


print(dp1[5])
### BUGGY CODE ###

K, S = list(map(int, input().split()))

ans = 0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x+y+z == S:
                ans += 1

print(ans)


### FIXED CODE ###

K, S = list(map(int, input().split()))

ans = 0
for x in range(K+1):
    n = 0
    if S < x:
        break
    for y in range(K+1):
        n = S - (x + y)
        if 0 <= n <= K:
            ans += 1

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

s=input()
dp=[[0]*13 for _ in range(len(s))]
if s[0]=='?':
  dp[0]=[1]*10+[0]*3
else:
  dp[0][int(s[0])]+=1

MOD=10**9+7
for i in range(1,len(s)):
  if s[i]=='?':
    for j in range(13):
      for k,l in enumerate([5,6,7,8,9]):
        dp[i][((j*10)%13+k)%13]+=dp[i-1][j]
        dp[i][((j*10)%13+k)%13]%=MOD
        dp[i][((j*10)%13+l)%13]+=dp[i-1][j]
        dp[i][((j*10)%13+l)%13]%=MOD
  else:
    k=int(s[i])
    for j in range(13):
      dp[i][((j*10)%13+k)%13]+=dp[i-1][j]
      dp[i][((j*10)%13+k)%13]%=MOD
print(dp[-1][5])

### FIXED CODE ###

s=input()
dp=[[0]*13 for _ in range(len(s))]
if s[0]=='?':
  dp[0]=[1]*10+[0]*3
else:
  dp[0][int(s[0])]+=1

MOD=10**9+7
for i in range(1,len(s)):
  if s[i]=='?':
    for j in range(13):
      for k in range(10):
        dp[i][((j*10)%13+k)%13]+=dp[i-1][j]
        dp[i][((j*10)%13+k)%13]%=MOD
  else:
    k=int(s[i])
    for j in range(13):
      dp[i][((j*10)%13+k)%13]+=dp[i-1][j]
      dp[i][((j*10)%13+k)%13]%=MOD
print(dp[-1][5])
### BUGGY CODE ###

N = int(input())
def Lucas(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else:
        one = Lucas(n-1)
        two = Lucas(n-2)
        return one+two
print(Lucas(N))

### FIXED CODE ###

from functools import lru_cache
N = int(input())
@lru_cache(maxsize=1000)
def luca(n):
    if n == 0:
        return 2
    elif n == 1:
        return 1
    else:
        return luca(n-1)+luca(n-2)
print(luca(N))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(500000)


def dfs(c,p,d):
    if c == R:
        if ans[0] > d:
            ans[0] = d
        return
    for i in range(R):
        if memo[i]:continue
        memo[i] = True
        if p == -1:
            dfs(c+1,i,0)
        else:dfs(c+1,i,d+graph[r[p]][r[i]])
        memo[i] = False

N,M,R = map(int,input().split())
r = [i-1 for i in map(int,input().split())]
graph = [[float("Inf") if i != j else 0 for i in range(N)] for j in range(N)]
for i in range(M):
    x,y,z = map(int,input().split())
    graph[x-1][y-1] = z
    graph[y-1][x-1] = z
for k in range(N):
    for i in range(N):
        for j in range(N):
            if graph[i][j] > graph[i][k] + graph[k][j]:
                graph[i][j] = graph[i][k] + graph[k][j]
memo = [False]*R
ans = [float("Inf")]
dfs(0,-1,0)
print(ans[0])

### FIXED CODE ###

def dfs(count,last,distance):
    if (count == r):
        if (ans[0] > distance ):ans[0] = distance
        return
    for i in range(r):
        if seen[i]:continue
        seen[i] = True
        if last == -1:dfs(count+1,i,0)
        else:dfs(count+1,i,distance+dp[R[last]-1][R[i]-1])
        seen[i] = False

n,m,r = map(int,input().split())
R = list(map(int,input().split()))
dp = [[ 0 if i == j else float("inf") for i in range(n)] for j in range(n)]
for i in range(m):
    x,y,z = map(int,input().split())
    dp[x-1][y-1] = z
    dp[y-1][x-1] = z
for k in range(n):
    for i in range(n):
        for j in range(n):
            if dp[i][j] > dp[i][k] + dp[k][j]:
                dp[i][j] = dp[i][k] + dp[k][j]
ans = [float("Inf")]
seen = [False]*r
dfs(0,-1,0)
print(*ans)
### BUGGY CODE ###

import functools, fractions

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

gcd_max = 0

for i in range(n):
  ad = a[:i] + a[i + 1:]
  gcd = functools.reduce(fractions.gcd, ad)
  if gcd >= gcd_max:
    gcd_max = gcd

print(gcd_max)

### FIXED CODE ###

from fractions import gcd

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

gcdl = [0] * n
gcdr = gcdl[:]

gcdl[0]  = a[0]
gcdr[-1] = a[-1] 

for i in range(1, n):
  gcdl[i] = gcd(a[i], gcdl[i - 1])

for i in range(n - 2, -1, -1):
  gcdr[i] = gcd(a[i], gcdr[i + 1])

max_gcd = max(gcdl[-2], gcdr[1])

for i in range(1, n - 1):
  temp_gcd = gcd(gcdl[i - 1], gcdr[i + 1])
  if temp_gcd > max_gcd:
    max_gcd = temp_gcd

print(max_gcd)
### BUGGY CODE ###

n = int(input())
a = list(input())
for i in range(n):
    if a[i] == 'E':
        a[i] = 1
    else:
        a[i] = 0

ans = 99999999999999999999
# print(a)
for i in range(n-1):
    l = 0
    r = 0
    if i > 0:
        l = sum(a[0:i])
        # print("l",a[0:i])
        l = abs(i-l)
    if i < n-1:
        # print("r",a[i+1:])
        r = sum(a[i+1:])
    # print(i,l,r)
    ans = min(l+r,ans)
print(ans)



### FIXED CODE ###

n = int(input())
a = list(input())
for i in range(n):
    if a[i] == 'E':
        a[i] = 1
    else:
        a[i] = 0

ans = 99999999999999999999
# print(a)
l = 0
r = sum(a)
for i in range(n):

    if i == 0:
        if a[i] == 1:
            r -= a[i]
            a[i] = 0
        else:
            a[i] = 1
        l = 0
    else:
        if a[i] == 1:
            a[i] = 0
            r -= 1
        else:
            a[i] = 1
        l += a[i-1]

    ans = min(l+r,ans)
    # print(i,l,r,ans)
print(ans)
### BUGGY CODE ###

N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
         
n = [1, 1]
cnt = 2
while cnt!=N+1:
    if cnt-1 in a:n[1]=0
    n[0], n[1] = n[1], n[0]+n[1] 
    cnt += 1
    if n[1]==0:break

print(n[-1]%(10**9+7))

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

broken= [False]*(N+1)
for i in range(M):
    broken[int(input())] = True

dp = [0]*(N+1)
dp[0] = 1
if not broken[1]:dp[1] = 1

         
for i in range(2, N+1):
    if broken[i]:continue
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= (10**9 + 7)
print(dp[N])
### BUGGY CODE ###

R, G, B, N = map(int, input().split())

ans = 0
for i in range(N // R + 1):
    for j in range((N - i * R) // G + 1):
        if (N - (i * R + j * G)) % B == 0 and (N - (i * R + j * G)) >= 0:
            ans += 1
print(ans)


### FIXED CODE ###

R, G, B, N = map(int, input().split())

ans = 0
for i in range(int(N / R) + 1):
    for j in range(int((N - i * R) / G) + 1):
        if ((N - (i * R + j * G)) % B == 0):
            ans += 1
print(ans)
### BUGGY CODE ###

n = int(input())
li = list(map(int, input().split()))
res = 0
m = 10**9 + 7
for i in range(0, len(li)-1):
    for j in range(i+1, len(li)):
        a = (li[i])%m
        b = (li[j])%m
        res = res%m + (a*b)%m
print(res)

### FIXED CODE ###

n = int(input())
li = list(map(int, input().split()))
res = 0
sum1 = sum(li)
sum2 = 0
m = 10**9 + 7
for i in range(0, len(li)-1):
    sum2 += li[i]
    res = (res + li[i]*(sum1-sum2))%m
print(res)
### BUGGY CODE ###

N, W = map(int, input().split())
dp = [[0] * (W+1) for _ in range(N+1)]
w, v = [0]*N, [0]*N
for i in range(N):
    w[i], v[i] = map(int,input().split())
for i in range(N):
    for k in range(W+1):
        if w[i] <= k:
            dp[i+1][k] = max(dp[i][k-w[i]]+v[i], dp[i][k])
        else:
            dp[i+1][k] = dp[i][k]
print(dp[N][W])


### FIXED CODE ###

N, W = map(int, input().split())
dp = [[0] * (W+1) for _ in range(N+1)]
w, v = [0]*N, [0]*N
for i in range(N):
    w[i], v[i] = map(int,input().split())
for i in range(N):
    for k in range(W+1):
        if w[i] <= k:
            dp[i+1][k] = max(dp[i][k-w[i]]+v[i], dp[i][k])
        else:
            dp[i+1][k] = dp[i][k]
print(dp[N][W])
### BUGGY CODE ###

n = int(input())
a = [int(i) for i in input().split()]
b = [0] * n
ans = []
for i in range(n, 0, -1):
    multi_list = [j for j in range(1, n + 1, 1) if j % i == 0]
    for multi in multi_list:
        b[i - 1] = (b[i - 1] + a[multi - 1]) % 2
    if b[i - 1] == 1:
        ans.append(str(i))
if a == b:
    print(len(ans))
    if len(ans) > 0:
        print(" ".join(ans))
else:
    print("-1")

### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
b = [0] * n
ans = []
for i in range(n, 0, -1):
    temp = sum(b[i - 1:n:i]) % 2
    if temp != a[i - 1]:
        b[i - 1] = 1
    if b[i - 1] == 1:
        ans.append(str(i))
print(len(ans))
if len(ans) > 0:
    print(" ".join(ans))
### BUGGY CODE ###

def main():

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

    res = [None]*q

    for i in range(q):

        l, r = map(int, input().split())
        count = 0

        for point in range(l-1, r-1):
            if s[point:point+2] == 'AC':
                count += 1

        res[i] = count

    for i in range(q):
        print(res[i])


main()


### FIXED CODE ###

def main():

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

    cumsum = [0]*n
    for i in range(n-1):
        if s[i:i+2] == 'AC':
            cumsum[i+1] = cumsum[i] + 1
        else:
            cumsum[i+1] = cumsum[i]

    res = [None]*q

    for i in range(q):

        l, r = map(int, input().split())
        res[i] = cumsum[r-1] - cumsum[l-1]

    for i in range(q):
        print(res[i])


main()
### BUGGY CODE ###

a,b,k = map(int,input().split())
for i in range(k):
  if a >= 1:
    a = a-1
  elif b >= 1:
    b = b-1
  else:
    pass
print(a,b)

### FIXED CODE ###

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

if a > k:
  print(a-k,b)
elif a == k:
  print(0,b)
else:
  if (a+b) > k:
    print(0,a+b-k)
  else:
    print(0,0)
### BUGGY CODE ###

def main():
    import sys
    N = int(input())
    left = 0
    right = N - 1
    table = ["?"]*N

    while 1:
        if table[left] == "?":
            print(left)
            sys.stdin.flush()
            le = input()
            if le == "Vacant":
                return
            table[left] = le
        if table[right] == "?":
            print(right)
            sys.stdin.flush()
            ri = input()
            if ri == "Vacant":
                return
            table[right] = ri
            c = (left + right) // 2
        if table[c] == "?":
            print(c)
            sys.stdin.flush()
            s = input()
            if s == "Vacant":
                return
            table[c] = s
        if (c - le) % 2 == 0 and table[left] != table[c]:
            right = c
        elif (ri - c) % 2 == 0 and table[right] != table[c]:
            left = c
        elif (c - le) % 2 == 1 and table[left] == table[c]:
            right = c
        elif (ri - c) % 2 == 1 and table[right] == table[c]:
            left = c
        else:
            raise Exception


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    import sys
    N = int(input())
    left = 0
    right = N
    table = ["?"]*N
    print(left)
    sys.stdin.flush()
    le = input()
    if le == "Vacant":
        return
    table[left] = le

    for i in range(20):
        c = (left + right) // 2
        print(c)
        sys.stdin.flush()
        s = input()
        if s == "Vacant":
            return
        table[c] = s
        if (c - left) % 2 == 0 and table[left] == table[c]:
            left = c
        elif (c - left) % 2 == 1 and table[left] != table[c]:
            left = c
        else:
            right = c


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

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

N = int(input())

ans = 0
for y in range(1, N):
    ans += y

print(ans)


### FIXED CODE ###

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

N = int(input())

ans = ((N + 1) * N) // 2
ans -= N

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

N = int(input())
S = input()
ans = 0
for i in range(N-3):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if j-i != k-j:
                if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                    ans += 1
print(ans)

### FIXED CODE ###

N = int(input())
S = input()
A = [[],[],[]]

for i in range(N):
    if S[i] == 'R':
        A[0].append(i)
    elif S[i] == 'G':
        A[1].append(i)
    else:
        A[2].append(i)
ans = len(A[0])*len(A[1])*len(A[2])
p = 0
for i in range(N):
  for j in range(N):
    if i+j+j <= N-1:
      if S[i] != S[i+j] and S[i] != S[i+j+j] and S[i+j] != S[i+j+j]:
        p += 1

print(ans-p)
### BUGGY CODE ###

a, b , n= input().split() 

max = 0
for i in range(1,int(n)+1,1):
    r = (int(a)*i // int(b)) - (int(a)* (i//int(b)))
    if r > max:
        max = r

print(max)


### FIXED CODE ###

a, b , n= input().split() 
a = int(a)
b = int(b)
n = int(n)
p = min(b,n)
if p % b ==0:
    print(int(a*(p-1)/b))
else:
    print(int(a*p/b))
### BUGGY CODE ###

import numpy as np
n, a, b = map(int, raw_input().split())
h = []
for i in xrange(n):
    h.append(int(raw_input()))
h = np.array(h)
count = 0
adiff = a - b
while(1):
    h = h - b
    h[np.argmax(h)] -= adiff
    count += 1
    if all(h <= 0):
        break
print count


### FIXED CODE ###

import numpy as np
n, a, b = map(int, raw_input().split())
h = []
for i in xrange(n):
    h.append(int(raw_input()))
h = np.array(h)
count = 0
adiff = float(a - b)
top = max(h) / b + 1
bottom = 0
mid = top / 2
while(1):
    if top - bottom < 2:
        break
    hmem = h - b * mid
    if np.sum(np.ceil(hmem[hmem > 0] / adiff)) <= mid:
        top = mid
    else:
        bottom = mid
    mid = (top + bottom) / 2
print top
### BUGGY CODE ###

import sys
from operator import mul
from functools import reduce

input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
l = (10 ** 18)
if 0 in a:
    print(0)
    exit()
c = reduce(mul, a)
if c > l:
    print(-1)
else:
    print(reduce(mul, a))

### FIXED CODE ###

import sys

input = sys.stdin.readline

N = int(input())
a = list(map(int, input().split()))
if 0 in a:
    print(0)
    exit()
c = 1
l = 10 ** 18
for i in a:
    c *= i
    if c > l:
        print(-1)
        exit()

print(c)