Harryxun/stf_run huggingface dataset:
n = int(input())
ans_list = [ 1 for i in range(n) ]

color_list = [ [0,-1] for i in range(10**5)] 
for i in range(n):
    color = int(input()) - 1
    color_list[color][0] += 1
    if color_list[color][0] > 0 and color_list[color][1] not in [i-1,-1]:
        ans_list[i] = ans_list[i-1] + ans_list[color_list[color][1]]
    else:
        ans_list[i] = ans_list[i-1]
    ans_list[i] %= 10**9+7
    color_list[color][1] = i
print(ans_list[-1])

### FIXED CODE ###


n = int(input())
ans_list = [ 1 for i in range(n) ]

color_list = [ -1 for i in range(2*(10**5))] 
for i in range(n):
    color = int(input()) - 1

    if color_list[color] not in [-1,i-1]:
        ans_list[i] = ans_list[i-1] + ans_list[color_list[color]]
    else:
        ans_list[i] = ans_list[i-1]
    ans_list[i] %= 10**9+7

    color_list[color] = i
print(ans_list[-1])
n,m=map(int,input().split())
lst=[]
for i in range(n):
  l=int(input())
  r=int(input())
  for j in range(l,r+1):
    lst.append(j)
print(len(set(lst)))


### FIXED CODE ###

n,m=map(int,input().split())
l=[]
r=[]
for i in range(m):
  a,b=map(int,input().split())
  l.append(a)
  r.append(b)
lm=max(l)
rm=min(r)
if rm-lm<0:
  print(0)
else:
  print(rm-lm+1)
def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

i = list(map(int, input().split()))
out = Base_10_to_n(i[0], i[1])
pritnt(out)

### FIXED CODE ###

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out
  
i = list(map(int, input().split()))
out = Base_10_to_n(i[0], i[1])
print(len(str(out)))
N = int(input())
A=(1,2,3,4,5,6,7,8,9)
B=(1,2,3,4,5,6,7,8,9)
count=0
for c in A:
  for d in B:
    e=c*d
    if N/e == 1 and N%e==0:
      count=count+1
if count >= 1 :
  print('Yes')
else:
  print('No')

### FIXED CODE ###

A, B = map(int, input().split())
if A >= 10 or B >=10:
  print(-1)
else:
  print(A*B)
s = input()
o = len(s)
while True:
  len(s) = b
  s.replace('00','')
  s.replace('11','')
  if(len(s) == b):
    break
print(o - len(s))

### FIXED CODE ###

s = input()
z = s.count('0')
if 2*z > len(s):
  print((len(s)-z)*2)
else:
  print(2*z)
while True :
    (H, W) = [int(i) for i in input().split()]

    if H == W == 0:
        break

    print('#' * W)
    for a in range(H - 2):
        print('#' + '.' * (W - 2) + '#')
    print('#' * W)

    print()

### FIXED CODE ###

while True:
    (H, W) = [int(i) for i in input().split()]
    
    if H == W == 0 :
        break

    print('#' * W)
    for a in range(H - 2) :
        print('#' + '.' * (W - 2) + '#')
    print('#' * W)
    print()
import math

n,a,b=map(int,input().split())
st="b"*a+"r"*b

num=math.floor(n/(a+b))
s=st*num

for i in range(n-len(s)):
  if i+1<=a:
    s+="b"
  else:
    s+="r"
    
print(s.count("b"))

### FIXED CODE ###

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

ab=a+b
num=n//ab
n-=ab*num

if n>=a:
  ans=a
  
else:
  ans=n
  
print(ans+num*a)
import numpy as np

N,W = map(int,input().split())
wv = np.array([list(map(int,input().split())) for _ in range(N)])
dp=np.zeros([N+1,W+1])

# 改善案
for i in range(1,N+1):
    dp[i][:wv[i-1][0]-1] = dp[i-1][:wv[i-1][0]-1]
    for j in range(wv[i-1][0],W+1):
        if dp[i-1][j] <= dp[i-1][j-wv[i-1][0]]+wv[i-1][1]:
            dp[i][j:N] = dp[i-1][j-wv[i-1][0]:N-wv[i-1][0]]+wv[i-1][1]
            break
        dp[i][j] = dp[i-1][j]
print(int(dp[-1,-1]))


### FIXED CODE ###

import numpy as np

N,W = map(int,input().split())
wv = np.array([list(map(int,input().split())) for _ in range(N)])
dp=np.zeros([N+1,W+1])

#　繰り返し回数節約
for i in range(1,N+1):
    dp[i][:wv[i-1][0]] = dp[i-1][:wv[i-1][0]]
    dp[i][wv[i-1][0]:] = np.maximum(dp[i-1][wv[i-1][0]:],dp[i-1][:W+1-wv[i-1][0]]+wv[i-1][1])
print(int(dp[-1,-1]))
n, m = map(int, input())
 
if n <= 9 and m <= 9:
  print(n * m)
else:
  print(-1)

### FIXED CODE ###

n, m = map(int, input().split())
 
if n <= 9 and m <= 9:
  print(n * m)
else:
  print(-1)
N,M=map(int,input().split())
mod = 10**9+7
def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

def cnt(n):
  s = sum([comb(n-i,i,mod)%mod for i in range(n//2+1)]):
  s = s%mod
  return s

A0 = 0
ans = 1
for i in range(M):
  A1 = int(input()) - 1
  ans = (ans * cnt(A1-A0))%mod
  A0 = A1+2
ans = (ans * cnt(N-A0))%mod
print(ans)



### FIXED CODE ###

N,M=map(int,input().split())
mod = 10**9+7
fram = [1]
for i in range(1,N+1):
  fram.append(fram[-1]*i%mod)

#def framod(n, mod, a=1):
#    for i in range(1,n+1):
#        a = a * i % mod
#    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=fram[n]
    b=fram[k]
    c=fram[n-k]
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod

def cnt(n):
  s = sum([comb(n-i,i,mod)%mod for i in range(n//2+1)])
  s = s%mod
  return s

A0 = 0
ans = 1
for i in range(M):
  A1 = int(input()) - 1
  ans = (ans * cnt(A1-A0))%mod
  A0 = A1+2
ans = (ans * cnt(N-A0))%mod
print(ans)
from math import factorial
def cmb(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

def main():
    N, M = map(int, input().split())
    A = [-1] + [int(input()) for i in range(M)] + [N + 1]

    d = [0] * (len(A) - 1)
    for i in range(len(A) - 1):
        if A[i+1] - A[i] == 1:
            print(0)
            exit(0)
        d[i] = A[i+1] - 1 - (A[i] + 1)

    ans = 1
    for dd in d:
        if dd < 2:
            continue
        tmp = 0
        for j in range(round(dd/2) + 1):
            tmp += cmb(dd - j, j)
        ans *= tmp

    print(ans%1000000007)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import math
def cmb(n, r, mod, g1, g2):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

def main():
    N, M = map(int, input().split())
    A = [-1] + [int(input()) for i in range(M)] + [N + 1]

    mod = 10**9+7 #出力の制限
    N = 10**5
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    for i in range( 2, N + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )

    d = [0] * (len(A) - 1)
    for i in range(len(A) - 1):
        if A[i+1] - A[i] == 1:
            print(0)
            exit(0)
        d[i] = A[i+1] - 1 - (A[i] + 1)

    ans = 1
    for dd in d:
        if dd > 1:
            tmp = 0
            for j in range(dd//2 + 1):
                tmp += cmb(dd - j, j, mod, g1, g2)
            ans *= tmp

    print(ans % 1000000007)

if __name__ == '__main__':
    main()
n=int(input())
if [i for i in [int(input()) for _ in range(n)] if i % 2]:
  print('first')
 else:
  print('second')

### FIXED CODE ###

n=int(input())
if [i for i in [int(input()) for _ in range(n)] if i % 2]:
    print('first')
else:
    print('second')
a = int(input())
if(a<3200){
  print("red")
}else{
  print(input())
}

### FIXED CODE ###

a = int(input())
if a < 3200:
  print("red")
else:
  print(input())
N, M = map(int,input().split())
X = list(map(int,input().split()))
X.sort()

X_dif = []

for i in range(M-1):
    X_dif.append(X[i+1]-X[i])
    
X_dif.sort()
X_dif.reverse()

for N in range(N-1):
    X_dif.pop(0)
    
print(sum(X_dif))

### FIXED CODE ###

# print('input >>')
N, M = map(int,(input().split()))
X = list(map(int,(input().split())))
X.sort()
Xdiff = [X[i + 1] - X[i] for i in range(len(X) - 1)]
Xdiff.sort(reverse=True)
ans = (X[-1]-X[0]) - sum(Xdiff[:N-1])

# print('----------output----------')
print(ans)
from collections import Counter
N = int(input())
A = Counter(list(map(int,input().split())))
Ans = 0
B = A.most_common()
for n,c in B:
    Ans = max(Ans,B[n]+B[n-1]+B[n+1])
print(Ans)

### FIXED CODE ###

from collections import Counter
N = int(input())
A = Counter(list(map(int,input().split())))
Ans = 0
for n,c in A.most_common():
    Ans = max(Ans,A[n]+A[n-1]+A[n+1])
print(Ans)
a=list(input())
b=list(input())
c=list(input())
x=a
y=''
While True:
  y=x[0]
  x.pop(0)
  x=y
  if len(a)==0:
    print('A'):
      break
  if len(b)==0:
    print('B')
    break
  if len(c)==0:
    print('C')
    break

### FIXED CODE ###

a=list(input())
b=list(input())
c=list(input())
order='a'
while True:
  if order=='a':
    if len(a)==0:
      print('A')
      break
    else:
      order=a[0]
      a=a[1:]
  elif order=='b':
    if len(b)==0:
      print('B')
      break
    else:
      order=b[0]
      b=b[1:]
  elif order=='c':
    if len(c)==0:
      print('C')
      break
    else:
      order=c[0]
      c=c[1:]
#!/usr/bin/env python3
from math import sqrt
 
a, b, c = map(desimal, input().split())
if sqrt(a) + sqrt(b) < sqrt(c):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

from decimal import *
 
a, b, c = map(Decimal, input().split())
if a.sqrt() + b.sqrt() < c.sqrt():
    print('Yes')
else:
    print('No')
n = input()
li = list(map(int,input().split()))
false = 0
for i in range(n):
    if i != li[i]:
        false += 1
if false == 0 or false == 2:
    print('YES')
else:
    print('N0')

### FIXED CODE ###

n = input()
li = list(map(int,input().split()))
false = 0
for i in range(int(n)):
    if (i+1) != li[i]:
        false += 1
if false == 0 or false == 2:
    print('YES')
else:
    print('NO')
height_list = [int(input()) for i in range(10)]
for i in range(1,4): print sorted(height_list)[-i]

### FIXED CODE ###

import sys 
height_li = []
for i in range(10):
    height_li.append(int(input()))
for i in range(3):
    print(sorted(height_li,reverse=True)[i])
#!/usr/bin/env python
# coding: utf-8

# In[9]:


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


# In[10]:


mylist = list(range(A,B+1))
ans = [x for x in mylist if x < A+K or x > B-K]
print(ans)


# In[ ]:






### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[41]:


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


# In[42]:


ans = []
for x in range(A, min(A+K,B+1)):
    ans.append(x)
for x in range(max(A,B-K+1), B+1):
    ans.append(x)
for x in sorted(list(set(ans))):
    print(x)


# In[ ]:
import math
n = int(input())
l = list(map(int, input().split()))
m = l[0]
for i in range(1, n):
    m = m * l[i] // math.gcd(m, l[i])
m = m - 1
ans = 0
for i in l:
    ans += m % i
print(ans)

### FIXED CODE ###

import fractions
n = int(input())
l = list(map(int, input().split()))
m = l[0]
for i in range(1, n):
    m = m * l[i] // fractions.gcd(m, l[i])
m = m - 1
ans = 0
for i in l:
    ans += m % i
print(ans)
a = '#'
while True:
	x = map(int,raw_input().split(' '))
	H = x[0]
	W = x[1]
	if H != 0 and W == 1:
		for i in range(H):
			print '#'
	elif H != 0 and W != 0 and W != 1:
		for r in range(H):
			for val in range(W-1):
				a += '#'
			print a
			a = '#'
		continue
	else:
		break

### FIXED CODE ###

x = []
y = range(1,14)
for val in y:
	x.append('S ' + str(val))
for val in y:
	x.append('H ' + str(val))
for val in y:
	x.append('C ' + str(val))
for val in y:
	x.append('D ' + str(val))
r = input()
n = range(1,r+1)
m = range(1,53-r)
for val in n:
	x.remove(raw_input())
for val in x:
	print val
half_length = all_length / 2
before_sum = 0
after_sum = 0
for ax in length_list:
    if before_sum+ax < half_length:
        before_sum += ax
        continue
    else:
        after_sum = before_sum + ax
        break
before_diff = all_length - before_sum 
after_diff = all_length - after_sum

if before_diff < after_diff:
    print(before_diff - before_sum)
else:
    print(after_sum - after_diff)


### FIXED CODE ###

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

all_length = sum(length_list)

half_length = all_length / 2
before_sum = 0
after_sum = 0
for ax in length_list:
    if before_sum+ax < half_length:
        before_sum += ax
        continue
    else:
        after_sum = before_sum + ax
        break
before_diff = all_length - before_sum 
after_diff = all_length - after_sum

if before_diff - before_sum < after_sum - after_diff:
    print(before_diff - before_sum)
else:
    print(after_sum - after_diff)
N,A,B=map(int,input().split())
i=N//((A+B)*(10**100))*A
if N%((A+B)*(10**100))>A:
    i=i+A
else:
    i=i+(N%(A+B)*(10**100))
print(i)

### FIXED CODE ###

S=input()
if (S[0]==S[1]==S[2]):
    print('No')
else:
    print('Yes')
r = int(input())
m=3.141592
s=r**2*m
l=2*r*m
print(s,l)

### FIXED CODE ###

import math
r=float(input())
m=float(math.pi)
s=r*r*m
l=2*r*m
print(s,l)
def stringconcant(S,T):
    x = S
    b = T
    c = x+b
    return c

S,T= input().split()
x = stringconcant(T,S)
print(a)

### FIXED CODE ###


a, b = input().split()

print(b,end='')
print(a,end='')
D = input()
 
if D == "25":
	print("Christmas")
elif D === "24":
	print("Christmas Eve")
elif D == "23":
	print("Christmas Eve Eve")
elif D == "22":
	print("Christmas Eve Eve Eve")


### FIXED CODE ###

D = int(input())
 
if D == 25:
	print("Christmas")
elif D == 24:
	print("Christmas Eve")
elif D == 23:
	print("Christmas Eve Eve")
elif D == 22:
	print("Christmas Eve Eve Eve")
import requests
S = input()
s = requests.session()
data={
    "data":S
}
url = "http://13.231.150.9/b.php"
print("None")
s.post(url,data=data)


### FIXED CODE ###

a,b,c, = list(map(int,input().split(" ")))
if abs(a-b)>abs(a-c):
    print("B")
else:
    print("A")
N = int(input())
A = list(map(int, input().split()))

DP = [0] * (10 ** 6 + 1)

A.sort()
Sum = 0

for i in range(N):

    if DP[A[i]] == 0:
        for j in range(1, 10 ** 6):
            if A[i] * j <= 10 ** 6:
                DP[A[i] * j] = 1
            else:
                break

        if i == 0:
            if A[i] != A[i + 1]:
                Sum += 1
        elif i < N - 1:
            if A[i] != A[i + 1] and A[i] != A[i - 1]:
                Sum += 1
        else:
            if A[i] != A[i - 1]:
                Sum += 1
print(Sum)


### FIXED CODE ###

from collections import defaultdict

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

DP = [0] * (10 ** 6 + 1)

A.sort()
Sum = 0

d = defaultdict(int)
for key in A:
    d[key] += 1

for i in range(N):

    if DP[A[i]] == 0:
        for j in range(1, 10 ** 6):
            if A[i] * j <= 10 ** 6:
                DP[A[i] * j] = 1
            else:
                break

        if d[A[i]] == 1:
            Sum += 1
print(Sum)
N = int(input())
MOD = 10**9 + 7

tree = [[] for i in range(N)]
for i in range(N-1):
  x, y = map(int, input().split())
  tree[x-1].append(y-1)
  tree[y-1].append(x-1)

dp1 = [0]*N # 頂点iが白のときに、頂点iを根とする部分木の塗り方の組み合わせ
dp2 = [0]*N # 頂点iが黒のときに、頂点iを根とする部分木の塗り方の組み合わせ


# nodeを白で塗るときに、nodeを根とする部分木の塗り方の組み合わせを求める
def solve1(node, parent): 
  global dp1
  global dp2
  if dp1[node]:
    return dp1[node]
  else:
    children = tree[node]
    if len(children)==0 or \
        len(children)==1 and children[0]==parent: # nodeがリーフのとき
      dp1[node] = 1 # nodeを白に塗る1通りだけ
      return dp1[node]
    
    else:
      dp1[node] = 1
      for child in children:
        if child == parent:
          continue

        dp1[node] *= solve1(child, node) + solve2(child, node)
        dp1[node] %= MOD

      return dp1[node]


# nodeを黒で塗るときに、nodeを根とする部分木の塗り方の組み合わせを求める
def solve2(node, parent):
  global dp1
  global dp2
  if dp2[node]:
    return dp2[node]
  else:
    children = tree[node]
    if len(children)==0 or \
    len(children)==1 and children[0]==parent: # nodeがリーフのとき
      dp2[node] = 1 # nodeを黒に塗る1通りだけ
      return dp2[node]
    
    else:
      dp2[node] = 1
      for child in children:
        if child == parent:
          continue

        dp2[node] *= solve1(child, node)
        dp2[node] %= MOD

      return dp2[node]


print((solve1(0, -1)+solve2(0, -1))%MOD)

### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(10**9)

N = int(input())
MOD = 10**9 + 7

tree = [[] for i in range(N)]
for i in range(N-1):
  x, y = map(int, input().split())
  tree[x-1].append(y-1)
  tree[y-1].append(x-1)

dp1 = [0]*N # 頂点iが白のときに、頂点iを根とする部分木の塗り方の組み合わせ
dp2 = [0]*N # 頂点iが黒のときに、頂点iを根とする部分木の塗り方の組み合わせ


# nodeを白で塗るときに、nodeを根とする部分木の塗り方の組み合わせを求める
def solve1(node, parent): 
  global dp1
  global dp2
  if dp1[node]:
    return dp1[node]
  else:
    children = tree[node]
    if len(children)==0 or \
        len(children)==1 and children[0]==parent: # nodeがリーフのとき
      dp1[node] = 1 # nodeを白に塗る1通りだけ
      return dp1[node]
    
    else:
      dp1[node] = 1
      for child in children:
        if child == parent:
          continue

        dp1[node] *= solve1(child, node) + solve2(child, node)
        dp1[node] %= MOD

      return dp1[node]


# nodeを黒で塗るときに、nodeを根とする部分木の塗り方の組み合わせを求める
def solve2(node, parent):
  global dp1
  global dp2
  if dp2[node]:
    return dp2[node]
  else:
    children = tree[node]
    if len(children)==0 or \
        len(children)==1 and children[0]==parent: # nodeがリーフのとき
      dp2[node] = 1 # nodeを黒に塗る1通りだけ
      return dp2[node]
    
    else:
      dp2[node] = 1
      for child in children:
        if child == parent:
          continue

        dp2[node] *= solve1(child, node)
        dp2[node] %= MOD

      return dp2[node]


print((solve1(0, -1)+solve2(0, -1))%MOD)
s = list(map(int, input()))0
print(min(len(s)-sum(s), sum(s))*2)

### FIXED CODE ###

s = list(map(int, input()))
print(min(len(s)-sum(s), sum(s))*2)
N = int(input())
A = [int(i) for i in input().split()]
f = 0
A.sort()
for i in range(len(A)):
    if A[i] == A[i+1]:
        f = 1
        break
        
if f > 0:
    print("NO")
else:
    print("YES")



### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
f = 0
A.sort()
for i in range(len(A)):
    if i != len(A)-1:
        if A[i] == A[i+1]:
            f = 1
            break
        
if f > 0:
    print("NO")
else:
    print("YES")
import math
class Graph(object):
    def __init__(self,v):
        self.v = v
        self.visited = [False for i in range(v)]
        self.adj = [[] for i in range(v)]
        self.parent = [-1 for i in range(v)]
        self.distance = [0 for i in range(v)]

    def AddEdge(self,a,b):
        self.adj[a].append(b)
        self.adj[b].append(a)

    def BFS(self,start):
        Q = [start]
        self.visited[start] = True
        while len(Q)>0:

            cur = Q.pop(0)
            for child in self.adj[cur]:
                if self.visited[child]==False:
                    self.visited[child] = True
                    self.distance[child] = self.distance[cur]+1
                    self.parent[child] = cur
                    Q.append(child)

    def CycleDetection_Using_BFS(self,start):
        Q = [start]
        self.visited[start] = True
        while len(Q)>0:

            cur = Q.pop(0)
            for child in self.adj[cur]:
                if self.visited[child]==False:
                    self.visited[child] = True
                    self.distance[child] = self.distance[cur]+1
                    self.parent[child] = cur
                    Q.append(child)
                else:
                    if self.parent[cur]!=child:
                        return True

        return False

NK= list(map(int,input().split(' ')))
n,k = NK[0] , NK[1]
h = list(map(int,input().split(' ')))
dp = [math.inf]*n
for i in reversed(range(n)):
    m = math.inf
    for j in range(1,k+1):
        Move = i+j
        if Move<=n-1:
            m = min(m,dp[Move]+abs(h[i]-h[Move]))
    dp[i] = m if m!=math.inf else 0
print(dp[0])




### FIXED CODE ###

import math
from functools import lru_cache
def Frog1():
    n = int(input())
    h = list(map(int,input().split(' ')))
    @lru_cache(None)
    def Solve(i):
        if i==n-1:
            return 0
        if i==n-2:
            return abs(h[i]-h[i+1])
        return min(Solve(i+1)+abs(h[i]-h[i+1]),Solve(i+2)+abs(h[i]-h[i+2]))
    dp = [0]*n
    for i in reversed(range(n)):
        if i==n-1:
            dp[i] = 0
        elif i==n-2:
            dp[i] = abs(h[i]-h[i+1])
        else:
            dp[i] = min(dp[i+1]+abs(h[i]-h[i+1]),dp[i+2]+abs(h[i]-h[i+2]))
    print(dp[0])
def Frog2():
    n,k = input().split(' ')
    n,k = int(n),int(k)
    h = list(map(int, input().split(' ')))
    @lru_cache(None)
    def Solve(i):
        if i==n-1:
            return 0
        ans = math.inf
        for j in range(1,k+1):
            new_i = i+j
            if new_i<=n-1:
                ans = min(ans , Solve(new_i)+abs(h[i]-h[new_i]))
            else:
                break
        return ans

    dp = [0]*n
    for i in reversed(range(n)):
        if i==n-1:
            dp[i] = 0
        else:
            ans = math.inf
            for j in range(1,k+1):
                new_i = i+j
                if new_i<=n-1:
                    ans = min(ans,dp[new_i]+abs(h[i]-h[new_i]))
                else:
                    break
            dp[i] = ans
    print(dp[0])

Frog2()
n = int(input())
lst = []
for i in range(n):
  x, l = map(int, input().split())
  left = x - l
  right = x + l
  lst.append([left, right])

lst = sorted(lst, key=lambda x: x[1])

ans = 1
limit = lst[0][1]
for i in range(n):
  if lst[i][0] >= limit:
    ans += 1
    limit = lst[i][1]

print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
need = [list(map(int, input().split())) for i in range(m)]
need = sorted(need, key=lambda x: x[1])

ans = 1
stock = need[0][1]
for i in range(m):
  if stock <= need[i][0]:
    ans += 1
    stock = need[i][1]
    
print(ans)
def main():
  	N = int(input())
	l = list(map(int, input().split(" ")))
	k = 0
	for i in range(N-2):
    	a = l[i]
    	for j in range(i+1, N-1):
        	b = l[j]
        	k += len([p for p in l[j+1:] if abs(b-a) < p < (a+b)])
	print(k)
main()

### FIXED CODE ###

from bisect import bisect_right
def main():
	N = int(input())
	L = list(map(int, input().split(" ")))
	L.sort()
	k = 0
	for i in reversed(range(2, N)):
		a = L[i]
		for j in reversed(range(1, i)):
			b = L[j]
			index = bisect_right(L, a-b, hi=j)
			k += j - index
	print(k)
if __name__ == "__main__":
    main()
# -*- coding: <encoding name> -*-

n = int(input())
total = 0
for i in range(1, n + 1):
	if (i % 3) != 0 and (i % 5) != 0:
		total +=
print(total)


### FIXED CODE ###

# -*- coding: <encoding name> -*-

n = int(input())
total = 0
for i in range(1, n + 1):
	if (i % 3) != 0 and (i % 5) != 0:
		total += i
print(total)