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

def prime(n):
    if n==1:
        return False
    flag=True
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            flag=False
    return flag

Q=int(input())
L=[0]*Q
for _ in range(Q):
    l,r=list(map(int, input().split()))
    ct=0
    for i in range(l,r+1,2):
        n,m=i,(i+1)//2
        flag=prime(n)&prime(m)
        ct+=flag
    L[_]=ct
for _ in range(Q):
    print(L[_])

### FIXED CODE ###

S = set()
L = [True]*(10**5+1)
L[0] = False
L[1] = False
for i in range(2, 10**5+1):
    if L[i]:
        S.add(i)
        for j in range(i*2, 10**5+1, i):
            L[j] = False


def prime(n):
    return n in S


M = [0]*(5*10**4+1)
for i in range(1, 5*10**4+1):
    m = 2*i-1
    n = i
    M[i] = M[i-1]+(prime(m) & prime(n))

Q = int(input())
ans = [0]*Q
for _ in range(Q):
    l, r = list(map(int, input().split()))
    i = (l+1)//2
    j = (r+1)//2
    ans[_] = M[j]-M[i-1]
for _ in range(Q):
    print(ans[_])
### BUGGY CODE ###

a = int(input()) 
b = [int(input()) for i in range(a)] 
 
m=max(b)
for i in range(a):
  if m>b[i]:
    print(m)
  else:
    d=b[i]
    b.pop(i)
    print(max(b))
    b.insert(i,d)

### FIXED CODE ###

a = int(input()) 
b = [int(input()) for i in range(a)] 
 
m=max(b)
sorted(b)
s=sorted(b)[-2]
for i in range(a):
  if m>b[i]:
    print(m)
  else:
    print(s)
### BUGGY CODE ###

from collections import Counter

N = int(input())
A = list(map(int, input().split()))
C = Counter(A)
ans = N
l = 1
r = 10**5
while l != r or (l == r and C[l] > 1):
    while C[l] <= 1:
        l += 1
    while C[r] <= 1:
        r -= 1

    if l != r:
        res = min(C[l], C[r]) - 1
    else:
        res = C[l]//2
    C[l] -= res
    C[r] -= res
    ans -= 2*res
print(ans)


### FIXED CODE ###

from collections import Counter

N = int(input())
A = list(map(int, input().split()))
C = Counter(A)
ans = len(C)
if (N-ans) % 2 == 1:
    ans -= 1
print(ans)
### BUGGY CODE ###

n=int(input())
c = input()
l =list(c)
L = len(l)//2
ans = 0

for i in range(n-1):
    for j in range(n-1,i,-1):
        if l[i]== 'W' and l[j] == 'R':
            l[j] = 'W'
            ans += 1
            break
print(ans)

### FIXED CODE ###

n=int(input())
c=input()
r=c.count("R")
r_1=c[:r].count("R")
ans=r-r_1
print(ans)
### BUGGY CODE ###

n, m = map(int, input().split())
mod = 1000000007
a = tuple(int(input()) for _ in range(m))

dp = [0]*(n+1)
dp[0] = 1
if 1 not in a:
    dp[1] = 1

for i in range(2, n+1):
    if i in a: continue
    dp[i] = dp[i-1] + dp[i-2]

print(dp[n]%mod)

### FIXED CODE ###

import sys
input = sys.stdin.readline

n, m = map(int, input().split())
mod = 1000000007
a = set(int(input()) for _ in range(m))

dp = [0]*(n+1)
dp[0] = 1
if 1 not in a:
    dp[1] = 1

for i in range(2, n+1):
    if i not in a: dp[i] = dp[i-1] + dp[i-2]

print(dp[n]%mod)
### BUGGY CODE ###

N=int(input())
A=[int(x) for x in input().split()]
def ka(b):
  k=0
  for i in range(N):
    k += abs(A[i]-(b+i+1))
  return k
answer = float('inf')
for j in range(-max(A)*2,max(A)*2):
  answer = min(answer,ka(j))
print(answer)

### FIXED CODE ###

import numpy as np
N=int(input())
A=[int(X) for X in input().split()]
B=[]
for i in range(N):
  B +=[A[i]-1-i]
B = np.array(sorted(B))
x = B[N//2]
answer = np.abs(B-x).sum()
print(answer)
### BUGGY CODE ###

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

for i in range(n - 1, 0, -1):
    if max(h_list[:i]) - h_list[i] >= 2:
        print('No')
        break
else:
    print('Yes')

### FIXED CODE ###

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

min_v = h_list[-1]
for i in range(n - 1, 0, -1):
    if h_list[i] < min_v:
        min_v = h_list[i]
    if h_list[i - 1] - min_v >= 2:
        print('No')
        break
else:
    print('Yes')
### BUGGY CODE ###

import itertools
N = int(input())
l = list(map(int, input().split()))
t = list(itertools.combinations(l,3))
count =0
for i in t:
    a,b,c = i
    if a<b+c and b<a+c and c<a+b:
        count+=1
print(count)

### FIXED CODE ###

import bisect
n = int(input())
l = list(map(int,input().split()))
l.sort()
ans =0
for i in range(1,n):
    for j in range(i):
        p = l[i]+ l[j]
        q = bisect.bisect_left(l,p)
        ans += q-i-1

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

import sys
import numpy as np

n, x, y = map(int, input().split())
x -= 1
y -= 1

def calc(i, j, x, y):
    mindist = abs(j - i)
    mindist = min(mindist, abs(x - i) + 1 + abs(y - j))
    mindist = min(mindist, abs(y - i) + 1 + abs(x - j))
    return mindist

result = [0 for i in range(n)]
dist = np.zeros((n, n))
for i in range(n):
    for j in range(n):
        if i == j :
            continue
        k = calc(i, j, x, y)       
        dist[i][j] = k
        result[k] += 1

for i in range(1, n):
    print(result[i] // 2)

### FIXED CODE ###

import sys

n, x, y = map(int, input().split())
x -= 1
y -= 1

def calc(i, j, x, y):
    mindist = abs(j - i)
    mindist = min(mindist, abs(x - i) + 1 + abs(y - j))
    mindist = min(mindist, abs(y - i) + 1 + abs(x - j))
    return mindist

result = [0 for i in range(n)]
for i in range(n):
    for j in range(n):
        if i == j :
            continue
        k = calc(i, j, x, y)       
        result[k] += 1

for i in range(1, n):
    print(result[i] // 2)
### BUGGY CODE ###

n = int(input())
h = list(map(int,input().split()))
count = 0
done = False
while done == False:
    for i in range(n):
        if i > 0 and h[i] <= 0 and h[i-1] >= 0:
            count += 1

        elif i == n-1 and h[i] > 0:
            count += 1

        h[i] -= 1
    if max(h) == 0:
        done = True
print(count)


### FIXED CODE ###

n = int(input())
h = list(map(int,input().split()))
count = 0
done = False
while done == False:
    for i in range(n):
        if h[i] >= 0:
            h[i] -= 1
        
        if i > 0 and h[i] < 0 and h[i-1] >= 0:
            count += 1

        if i == n-1 and h[i] >= 0:
            count += 1
    if max(h) <= 0:
        done = True
print(count)
### BUGGY CODE ###

N = int(input())
dic = {}
for i in range(1,N+1):
    dic[i] = int(input())
b = 1
lis = []
cnt = 0
while True:
    lis.append(b)
    b = dic[b]
    cnt += 1
    if b == 2:
        print(cnt)
        break
    elif b in lis:
        print(-1)
        break

### FIXED CODE ###

n = int(input())
butnum = {}
for i in range(1,n+1):
    butnum[i] = int(input())
pushbut = 1
pushedbut =[]
jud = 0
for j in range(1,n+1):
    pushbut = butnum[pushbut]
    if pushbut == 2:
        print(j)
        jud = 1
        break
if jud == 0:
    print(-1)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(500000) 
input = sys.stdin.readline
from collections import deque
from heapq import heapify, heappop, heappush
H,W = map(int,input().split())
C = list(map(int,input().split()))
C[0] -= 1; C[1] -= 1
D = list(map(int,input().split()))
D[0] -= 1; D[1] -= 1
S = []; INF = float("inf")
for i in range(H):
  temp = str(input());temp =list(temp)
  S.append(temp)
#print(S)
reach = [[INF]*W for _ in range(H)]
reach[C[0]][C[1]] = 0
visit = [[False]*W for _ in range(H)]
dxdy = [(1,0),(-1,0),(0,1),(0,-1)]
Q = []
Q.append((0,C))
while Q:
  score,z = heappop(Q)
  x = z[0];y=z[1]
  if visit[x][y]:
    continue
  visit[x][y] = True
 
  for i in range(4):
    nx = x + dxdy[i][0]
    ny = y + dxdy[i][1]
    #print(nx,ny)
    if 0<=nx<H and 0<=ny<W and S[nx][ny] == "." and reach[nx][ny] > score:
      reach[nx][ny] = min(score,reach[nx][ny])
      u = [nx,ny]
      heappush(Q,(score,u))
  #print(reach)
 
  for i in range(5): #0~4
    for j in range(5):
      mx = x-2 + i
      my = y-2 + j
      if i == 2 and j == 2:
        continue
      if mx < 0 or mx >= H or my < 0 or my >= W or S[mx][my] == "#":
        continue
      if reach[mx][my] <= score+1: #すでにこのスコア以下でいける。
        continue
      reach[mx][my] = min(score+1,reach[mx][my])
      p = [mx,my]
      #print(v,p,"X")
      heappush(Q,(score+1,p))
#dfs(C,0)
#print(reach)
#print(reach[D[0]][D[1]])
if reach[D[0]][D[1]] == INF:
  print(-1)
else:
  print(reach[D[0]][D[1]])

### FIXED CODE ###

import sys
sys.setrecursionlimit(500000) 
input = sys.stdin.readline
from collections import deque
H,W = map(int,input().split())
C = list(map(int,input().split()))
C[0] -= 1; C[1] -= 1
D = list(map(int,input().split()))
D[0] -= 1; D[1] -= 1
S = []; INF = float("inf")
for i in range(H):
  temp = str(input());temp =list(temp)
  S.append(temp)
#print(S)
reach = [[INF]*W for _ in range(H)]
reach[C[0]][C[1]] = 0
dxdy = [(1,0),(-1,0),(0,1),(0,-1)]
Q = deque([])
Q.append([C,0])
while Q:
  z, score = Q.popleft()
  x = z[0];y=z[1]
 
  for i in range(4):
    nx = x + dxdy[i][0]
    ny = y + dxdy[i][1]
    #print(nx,ny)
    if 0<=nx<H and 0<=ny<W and S[nx][ny] == "." and reach[nx][ny] > score:
      reach[nx][ny] = min(score,reach[nx][ny])
      u = [nx,ny]
      Q.appendleft([u,score])
  #print(reach)
 
  for i in range(5): #0~4
    for j in range(5):
      mx = x-2 + i
      my = y-2 + j
      if i == 2 and j == 2:
        continue
      if mx < 0 or mx >= H or my < 0 or my >= W or S[mx][my] == "#":
        continue
      if reach[mx][my] <= score+1: #すでにこのスコア以下でいける。
        continue
      reach[mx][my] = min(score+1,reach[mx][my])
      p = [mx,my]
      #print(v,p,"X")
      Q.append([p,score+1])
#dfs(C,0)
#print(reach)
#print(reach[D[0]][D[1]])
if reach[D[0]][D[1]] == INF:
  print(-1)
else:
  print(reach[D[0]][D[1]])
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
b=[61*[0]for _ in range(n)]
c=[0]*61
for i in range(n):
  s=bin(a[i])[2:].zfill(61)
  for j in range(61):
    if s[-j-1]=="1":
      c[j]+=1
      b[i][j]=1
ans=0
mod=10**9+7
mod*=2
for i in range(n):
  x=1
  for j in range(61):
    if b[i][j]==1:s=n-c[j]
    else:s=c[j]
    ans+=s*x
    x=(x*2)%mod
    ans%=mod
print(ans//2)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
ans=0
x=1
for i in range(60):
  z=o=0
  for j in range(n):
    if a[j]%2:o+=1
    else:z+=1
    a[j]//=2
  ans+=(x*o*z)%mod
  ans%=mod
  x=(x*2)%mod
print(ans)
### BUGGY CODE ###

import os, sys, re, math

N, M = [int(s) for s in input().split(' ')]

cards = [True for _ in range(N+1)]
cards[0] = False

for _ in range(M):
    l,r = [int(s) for s in input().split(' ')]
    for i in range(1,l):
        cards[i] = False
    for j in range(r+1,len(cards)):
        cards[j] = False

print(sum(cards))


### FIXED CODE ###

import os, sys, re, math

N, M = [int(s) for s in input().split(' ')]

min_idx = 1
max_idx = 1e+5

for _ in range(M):
    l,r = [int(s) for s in input().split(' ')]
    min_idx = max(min_idx, l)
    max_idx = min(max_idx, r)
if max_idx >= min_idx:
    print(min(N, int(max_idx - min_idx + 1)))
else:
    print(0)
### BUGGY CODE ###

N, K = map(int, input().split())
dic = {}
for i in range(N):
    a, b = map(int, input().split())
    if a not in dic.keys():
        dic[a] = 0
    dic[a] += b
count = 0
for k, v in sorted(dic.items()):
    count += v
    if count >= K:
        print(k)
        break


### FIXED CODE ###

from collections import Counter
N, K = map(int, input().split())
c = Counter()
for _ in range(N):
    a, b = map(int, input().split())
    c[a] += b
for item in sorted(c.items(), key=lambda x: x[0]):
    if item[1] >= K:
        print(item[0])
        break
    else:
        K -= item[1]
### BUGGY CODE ###

s = input()
a, b = '', ''
for i in range(len(s)):
    if s[i] != 'x':
        a += s[i]
        b = s[i] + b
if a != b:
    print(-1)
ans = 0
while len(s) != 0:
    if s[0] == s[-1]:
        s = s[1:-1]
    elif s[0] == 'x' and s[-1] == 'x':
        if len(s) == 1:
            s = ''
        else:
            s = s[1:-1]
    elif s[0] == 'x':
        s = s[1:]
        ans += 1
    elif s[-1] == 'x':
        s = s[:-1]
        ans += 1
print(ans)

### FIXED CODE ###

import sys
s = input()
a, b = '', ''
for i in range(len(s)):
    if s[i] != 'x':
        a += s[i]
        b = s[i] + b
if a != b:
    print(-1)
    sys.exit()
ans = 0
while len(s) != 0:
    if s[0] == s[-1]:
        s = s[1:-1]
    elif s[0] == 'x' and s[-1] == 'x':
        if len(s) == 1:
            s = ''
        else:
            s = s[1:-1]
    elif s[0] == 'x':
        s = s[1:]
        ans += 1
    elif s[-1] == 'x':
        s = s[:-1]
        ans += 1
print(ans)
### BUGGY CODE ###

s=input()
k=673
ans = 0
dp=[[0 for _ in range(k)] for _ in range(len(s))]
dp[0][int(s[0])] = 1
for i in range(1,len(s)):
    t = int(s[i])
    dp[i][t] += 1
    for j in range(k):
        dp[i][((10*j)+t)%k] += dp[i-1][j]
        #dp[i][j] += dp[i-1][j]
    ans += dp[i][0]
print(ans)


### FIXED CODE ###

from collections import Counter
S=list(map(int,input()))
P=2019
N=len(S)
if P not in [2,5]:
  pt = [1]
  for i in range(N):
    pt.append(pt[-1]*10%P)
  dp = [(S[0]*pt[N-1])%P]
  for i in range(1,N):
    dp.append((dp[-1]+S[i]*pt[N-1-i])%P)

  c = Counter(dp)
  ans = sum(u*(u-1)//2 for u in c.values())
  print(ans+c[0])
elif P==2:
  S = [int(c) for c in input()]
  ans = 0
  for i in range(N):
    if S[i]%2==0:
      ans += i+1
  print(ans)
else:
  ans = 0
  S = [int(c) for c in input()]
  for i in range(N):
    if S[i]%5==0:
      ans += i+1
  print(ans)
### BUGGY CODE ###

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

lst.sort()

visited = [0 for _ in range(n)]
ans = n
for i in range(n):
  if visited[i] == 0:
    for j in range(i+1,n):
      if lst[j] % lst[i] == 0:
        if visited[j] == 0:
          ans -= 1
          visited[j] = 1
          if lst[j] == lst[i] and visited[i] == 0:
            ans -= 1
            visited[i] = 1
             
print(ans)


### FIXED CODE ###

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


maxA = max(a)
dp = [0]*(maxA+1)
count = 0

for e in a:
    for i in range(e,maxA+1,e):
        dp[i] += 1

for e in a:
    if dp[e] == 1:
        count += 1

print(count)
### BUGGY CODE ###

n = int(input())
print(sum(range(n)))

### FIXED CODE ###

n = int(input())
print(n * (n - 1) // 2)
### BUGGY CODE ###

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

import sys
import os
import math


dice0 = list(map(int, input().split()))
dice1 = list(map(int, input().split()))

def dice_roll(dice, c):
    copy = dice[:]
    if c == 'E':
        dice[2] = copy[0]
        dice[5] = copy[2]
        dice[3] = copy[5]
        dice[0] = copy[3]
    elif c == 'N':
        dice[0] = copy[1]
        dice[4] = copy[0]
        dice[5] = copy[4]
        dice[1] = copy[5]
        pass
    elif c == 'S':
        dice[1] = copy[0]
        dice[0] = copy[4]
        dice[4] = copy[5]
        dice[5] = copy[1]
    elif c == 'W':
        dice[0] = copy[2]
        dice[2] = copy[5]
        dice[5] = copy[3]
        dice[3] = copy[0]
    # Y???????????¢
    elif c == 'R':
        dice[2] = copy[1]
        dice[4] = copy[2]
        dice[3] = copy[4]
        dice[1] = copy[3]
    return dice

# up???????????????
num = 0
while dice0[0] != dice1[0]:
    if num % 2 == 0:
        dice0 = dice_roll(dice0, 'E')
    else:
        dice0 = dice_roll(dice0, 'N')
    num += 1
    if num > 10:
        print('No')
        quit()

# front???????????????
while dice0[1] != dice1[1]:
    dice0 = dice_roll(dice0, 'R')

if dice0[2] == dice1[2] and dice0[3] == dice1[3] and dice0[4] == dice1[4] and dice0[5] == dice1[5]:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

import sys
import os
import math


dice0 = list(map(int, input().split()))
dice1 = list(map(int, input().split()))

def dice_roll(dice, c):
    copy = dice[:]
    if c == 'E':
        dice[2] = copy[0]
        dice[5] = copy[2]
        dice[3] = copy[5]
        dice[0] = copy[3]
    elif c == 'N':
        dice[0] = copy[1]
        dice[4] = copy[0]
        dice[5] = copy[4]
        dice[1] = copy[5]
        pass
    elif c == 'S':
        dice[1] = copy[0]
        dice[0] = copy[4]
        dice[4] = copy[5]
        dice[5] = copy[1]
    elif c == 'W':
        dice[0] = copy[2]
        dice[2] = copy[5]
        dice[5] = copy[3]
        dice[3] = copy[0]
    # Y???????????¢
    elif c == 'R':
        dice[2] = copy[1]
        dice[4] = copy[2]
        dice[3] = copy[4]
        dice[1] = copy[3]
    return dice


def check():
    global dice0
    global dice1

    # up???????????????
    num = 0
    while dice0[0] != dice1[0]:
        if num % 2 == 0:
            dice0 = dice_roll(dice0, 'E')
        else:
            dice0 = dice_roll(dice0, 'N')
        num += 1
        if num > 10:
            return False

    # front???????????????
    num = 0
    while dice0[1] != dice1[1]:
        dice0 = dice_roll(dice0, 'R')
        num += 1
        if num > 10:
            return False

    if dice0[2] == dice1[2] and dice0[3] == dice1[3] and dice0[4] == dice1[4] and dice0[5] == dice1[5]:
        return True
    else:
        return False

result = check()
if result:
    print('Yes')
else:
    # ????????????
    dice0 = dice_roll(dice0, 'N')
    result = check()
    if result:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

from collections import deque
N = int(input())
A = list(deque(map(lambda x: int(x) - 1, input().split())) for _ in range(N))
# print(A)
ans = 0
change = True
while True:
    change = False
    match = [-1] * N
    for player in range(N):
        if not A[player]:
            continue
        enemy = A[player][0]
        match[player] = enemy
        if match[enemy] == player:
            A[player].popleft()
            A[enemy].popleft()
            change = True
    if not change:
        break
    ans += 1


if all(len(row) == 0 for row in A):
    print(ans)
else:
    print('-1')

### FIXED CODE ###

from collections import deque
from pprint import pprint
N = int(input())
nextGame = [deque()] + [deque(map(int , input().split())) for _ in range(N)]
#print(nextGame)

canPlay = [[False] * (N + 1) for _ in range(N + 1)]
#pprint(canPlay)
days = [0] * (N + 1)
que = ([i for i in range(N + 1)])

while que:
    now = que.pop()
    #print("------------------------")
    if not nextGame[now]:
        continue
    enemy = nextGame[now].popleft()
    canPlay[now][enemy] = True
    #print("now : ",now)
    #print("enemy : ",enemy)
    #pprint(canPlay)

    if canPlay[now][enemy] and canPlay[enemy][now]:
        days[now] = days[enemy] = max(days[now], days[enemy]) + 1
        que.append(now)
        que.append(enemy)
    #print("days : ",days)

for test in nextGame:
    if test:
        print("-1")
        exit(0)
print(max(days))
### BUGGY CODE ###

import numpy as np

N = int(input())
A = [0] + list(map(int, input().split())) + [0]
size = len(A)
a = np.array([[A[i] for i in range(size) if i != l] for l in range(1, size-1)])

total = np.zeros(N, dtype='int64')

for i in range(size-2):
    total += np.abs(a[:, i]-a[:, i+1])

for i in range(N):
    print(total[i])

### FIXED CODE ###

from collections import deque

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

A.append(0)
A.appendleft(0)

A_diff = [abs(A[i+1] - A[i]) for i in range(N+1)]
A_sum = sum(A_diff)

for i in range(N):
    print(A_sum - (A_diff[i] + A_diff[i+1]) + abs(A[i+2] - A[i]))
### BUGGY CODE ###

import sys
readline = sys.stdin.readline

from scipy.special import comb

K = int(readline())
S = readline().rstrip()
S = len(S)
N = K + S

DIV = 10 ** 9 + 7

# K = 3, S = 5のとき
# ..X.X.X.
# Xが取る3か所を選んだ上で、
# 最も右のXよりも右のマス：各26通り
# 最も右のXを含む、それより左のマス：Xのマスは1通り、それ以外は各25通り
# 最も右のXが
# ..X.....　の状態から、
# .......X  
# の状態について、場合の数を求める

ans = 0
for xpos in range(S, N + 1):
  # xpos箇所からK箇所を選ぶ場合の数
  # 一番右に1個固定した状態で、残りのxpos - 1か所からS - 1個を選ぶ
  pat = comb(xpos - 1, S - 1, exact=True)
#  print("xpos",xpos,"ncr",ncr)
#  print(S,"from",xpos,"pat",pat)
  # その場合の数に対して、X以外の文字の選び方は25 ** (X - S)通りある
#  print("25 for",xpos - S,"boxes")
  pat *= pow(25, xpos - S, DIV)
  pat %= DIV
  
  # 残りのマスに対しては26通りずつ選べる
#  print("26 for ",N - xpos,"boxes")
  pat *= pow(26, N - xpos, DIV)
  pat %= DIV
#  print("xpos",xpos,"pat",pat)
  
  ans += pat
  ans %= DIV

print(ans)

### FIXED CODE ###

import sys
readline = sys.stdin.readline

K = int(readline())
S = readline().rstrip()
S = len(S)
N = K + S

DIV = 10 ** 9 + 7
n = (10 ** 6) * 5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, n + 1 ):
    g1.append( ( g1[-1] * i ) % DIV )
    inverse.append( ( -inverse[DIV % i] * (DIV//i) ) % DIV )
    g2.append( (g2[-1] * inverse[-1]) % DIV )

def nCr(n, r, DIV):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % DIV

# K = 3, S = 5のとき
# ..X.X.X.
# Xが取る3か所を選んだ上で、
# 最も右のXよりも右のマス：各26通り
# 最も右のXを含む、それより左のマス：Xのマスは1通り、それ以外は各25通り
# 最も右のXが
# ..X.....　の状態から、
# .......X  
# の状態について、場合の数を求める

ans = 0
for xpos in range(S, N + 1):
  # xpos箇所からK箇所を選ぶ場合の数
  # 一番右に1個固定した状態で、残りのxpos - 1か所からS - 1個を選ぶ
  pat = nCr(xpos - 1, S - 1, DIV)
#  print("xpos",xpos,"ncr",ncr)
#  print(S,"from",xpos,"pat",pat)
  # その場合の数に対して、X以外の文字の選び方は25 ** (X - S)通りある
#  print("25 for",xpos - S,"boxes")
  pat *= pow(25, xpos - S, DIV)
  pat %= DIV
  
  # 残りのマスに対しては26通りずつ選べる
#  print("26 for ",N - xpos,"boxes")
  pat *= pow(26, N - xpos, DIV)
  pat %= DIV
#  print("xpos",xpos,"pat",pat)
  
  ans += pat
  ans %= DIV

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

#!/usr/bin/env python3
import sys
import itertools
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right
from collections import Counter


def solve(N: int, L: "List[int]"):
    ans = 0
    L.sort()

    for x in range(N):
        for y in range(x+1,N):
            # if x==y : continue
            zs = bisect_right(L, max(L[x],L[y]))
            ze = bisect_left(L, L[x]+L[y])            
            cnt = 0
            if(zs <= x <= ze):
                cnt += 1
            if(zs <= y <= ze):
                cnt += 1
            ans += ((ze-zs)-cnt)

    print(ans)

    return
 


# Generated by 1.1.6 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()
    N = int(next(tokens))  # type: int
    L = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, L)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

from bisect import bisect_left, bisect_right



def solve(N: int, L: "List[int]"):
    ans = 0
    L.sort()

    for x in range(N):
        for y in range(x+1,N):
            ze = bisect_left(L, L[x]+L[y])            
            ans += (ze-y-1)
            
    print(ans)

    return
 


# Generated by 1.1.6 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()
    N = int(next(tokens))  # type: int
    L = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, L)

if __name__ == '__main__':
    main()