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

import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

a, b, k = inintm()

cnt = 0
ans = []
for i in range(a,b+1):
    cnt += 1
    if cnt <= k:
        ans.append(i)

cnt = 0
for i in range(a,b+1)[::-1]:
    cnt += 1
    if cnt <= k:
        ans.append(i)

ans = sorted(list(set(ans)))

for i in ans:
    print(i)

### FIXED CODE ###

import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

a, b, k = inintm()

for i in range(a,min(b, a+k-1)+1):
    print(i)
for i in range(max(a+k, b-k+1), b+1):
    print(i)
### BUGGY CODE ###

n, m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]
nl = [[] for i in range(n+1)]
for a,b in s: nl[a].append(b);nl[b].append(a)
ans = "IMPOSSIBLE"
for i in range(2,n):
    if i in nl[1] and i in nl[n]: ans = "POSSIBLE" 
print(ans)

### FIXED CODE ###

n, m = map(int,input().split())
s = [list(map(int,input().split())) for i in range(m)]
nl = [[0,0] for i in range(n+1)]
for a,b in s:
    if a == 1: nl[b][0] = 1
    if b == n: nl[a][1] = 1
ans = "POSSIBLE" if [1,1] in nl else "IMPOSSIBLE"
print(ans)
### BUGGY CODE ###

def solve():
    ans = 1
    N = int(input())
    s = input()
    ans = 0
    for i in range(1000):
        t = str(i).zfill(3)
        t_index = 0 
        for s_index in range(N):
            if s[s_index] == t[t_index]:
                t_index += 1
                if t_index == 3:
                    break
        if t_index == 3:
            ans += 1
    print(ans)
solve()

### FIXED CODE ###

def test(original: list, nums: str, index: int,
         remain_count: int, results: set, results_1, results_2):
    # 3桁抽出したら終了
    if len(nums) == 1:
        if nums in results_1:
            return
        results_1.add(nums)
    if len(nums) == 2:
        if nums in results_2:
            return
        results_2.add(nums)
    if len(nums) == 3:
        # print("".join(array))
        results.add(nums)
        return
    # 最終桁に到達したら終了
    if index == len(original):
        return
    for i in range(index, len(original), 1):
        test(
            original,
            nums + original[i],
            i + 1,
            remain_count,
            results,
            results_1,
            results_2)

    # この桁を抽出対象としないパターン
    # test(original, array[:], index + 1, remain_count - 1, results)


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

results = set()
results_1 = set()
results_2 = set()

# N個の要素
# N-3個を削除
# 3個の組み合わせが何通りあるか？
test(S, "", 0, N - 3, results, results_1, results_2)

print(len(results))
### BUGGY CODE ###

S=input()
Q=int(input())
sousa=[list(map(str,input().split())) for i in range(Q)]

for i in sousa:
    if int(i[0])==1:
        S=S[::-1]
    if int(i[0])==2:
        if int(i[1])==1:
            S=i[2]+S
        if int(i[1])==2:
            S=S+i[2]
print(S)

### FIXED CODE ###

S=input()
Q=int(input())
sousa=[list(map(str,input().split())) for i in range(Q)]
counter=0
up=''
down=''
for i in sousa:
    if i[0]=='1':
#         S=S[::-1]
        counter+=1
    if i[0]=='2':
        if counter%2==0:
            if i[1]=='1':
                up=i[2]+up
            if i[1]=='2':
                down=down+i[2]
        else:
            if i[1]=='1':
                down=down+i[2]
            if i[1]=='2':
                up=i[2]+up   
                
S=up+S+down
if counter%2==1:
    S=S[::-1]

print(S)
### BUGGY CODE ###

import bisect

n,c,k = map(int, input().split())
t = [int(input()) for i in range(n)]
t.sort()
ans = 1
while len(t) > 1:
    d = t[0]
    m = min(len(t),c)-1
    if t[m]-k <= d:
        t = t[m+1:]
    else:
        i = bisect.bisect_left(t, d+k)
        t = t[i:]
    if len(t):
        ans += 1
print(ans)

### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    n,c,k = LI()
    t = IR(n)
    t.sort()
    i = 0
    ans = 0
    while i < n:
        i = min(i+c,bisect.bisect_right(t, t[i]+k))
        ans += 1
    print(ans)
    return
#B
def B():

    return

#C
def C():

    return

#D
def D():

    return

#E
def E():

    return

#F
def F():

    return

#Solve
if __name__ == "__main__":
    A()
### BUGGY CODE ###

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


def comb(x,y):
    r = 1
    for i in range(x,x-y,-1):
        r *= i
    for i in range(y,0,-1):
        r //= i
    return r
def find(ID,a):
    tmp = a
    while tmp !=ID[tmp]:
        tmp = ID[tmp]
    return tmp
def union(ID,a,b):
    ida = find(ID,a)
    idb = find(ID,b)
    if ida!=idb:
        ID[ida] = idb
        tmp = SIZE[idb]*SIZE[ida]
        SIZE[idb] += SIZE[ida]
        return tmp 
    return 0
bridges = []
res = []
ID = []
SIZE = []
cnt = comb(n,2)
for i in range(n+1):
    ID.append(i)
    SIZE.append(1)
for i in range(m):
    a,b = map(int,input().split())
    bridges.append((a,b))

for i in range(m-1,-1,-1):
    res.append(cnt)
    cnt -= union(ID,bridges[i][0],bridges[i][1])
    

for i in res[::-1]:
    print(i)            


### FIXED CODE ###

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


def comb(x,y):
    r = 1
    for i in range(x,x-y,-1):
        r *= i
    for i in range(y,0,-1):
        r //= i
    return r
def find(ID,a):
    tmp = a
    while tmp !=ID[tmp]:
        tmp = ID[tmp]
    return tmp
def union(ID,a,b):
    ida = find(ID,a)
    idb = find(ID,b)
    if ida!=idb:
        ID[a] = idb
        ID[b] = idb
        ID[ida] = idb
        tmp = SIZE[idb]*SIZE[ida]
        SIZE[idb] += SIZE[ida]
        return tmp 
    return 0
bridges = []
res = []
ID = []
SIZE = []
cnt = comb(n,2)
for i in range(n+1):
    ID.append(i)
    SIZE.append(1)
for i in range(m):
    a,b = map(int,input().split())
    bridges.append((a,b))

for i in range(m-1,-1,-1):
    res.append(cnt)
    cnt -= union(ID,bridges[i][0],bridges[i][1])
    

for i in range(m-1,-1,-1):
    print(res[i])
### BUGGY CODE ###

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

for _ in range(M):
  value[value.index(max(value))] = max(value)//2
  
print(sum(value))

### FIXED CODE ###

import heapq as hp
n, m = map(int, input().split())
list_A = list(map(int, input().split()))
 
a_q = []
for i in list_A:
    hp.heappush(a_q, -1*i)
    
for i in range(m):
    tmp = hp.heappop(a_q)
    tmp = hp.heappush(a_q, int(tmp/2))
    
print(-sum(a_q))
### BUGGY CODE ###

N = input()
L = list(map(int,input().split()))
A = []
for a in L:
  if (a not in A):
    A.append(a)
J = [1]
for i in range(len(A)):
  p = L.count(A[i]-1)+L.count(A[i])+L.count(A[i]+1)
  if (J[0] < p):
    del J[0]
    J.append(p)
print(J[0])

### FIXED CODE ###

N = int(input())
L = list(map(int,input().split()))
L.sort()
L.append(1000000)
M = [0]*((10**5)+1)
c = 0
d = 1
num = L[0]
if N == 1:
  print(1)
elif N == 2:
  if abs(L[0]-L[1]) <=1 :
    print(2)
  else:
    print(1)
else:
  while c <= N-1:
    if L[c] == L[c+1]:
      d += 1
      c += 1
    else:
      M[num] = d
      d = 1
      c += 1
      num = L[c]
  M.insert(0,0)
  M.append(0)
  ans = 0
  for i in range(len(M)-2):
    if M[i]+M[i+1]+M[i+2] >= ans:
      ans = M[i]+M[i+1]+M[i+2]
  print(ans)
### BUGGY CODE ###

import heapq
push, pop = heapq.heappush, heapq.heappop

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

heapq.heapify(a)
for _ in range(m):
    b,c = list(map(int, input().split()))
    for _ in range(b):
        p = pop(a)
        if p < c:
            push(a, c)
        else:
            # キューに戻す
            push(a, p)
            break
print(sum(a))

### FIXED CODE ###

import heapq
push, pop = heapq.heappush, heapq.heappop

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

def modify():
    heapq.heapify(a)
    
    bc = [list(map(int, input().split())) for _ in range(m)]
    bc.sort(key=lambda x:x[1], reverse=True)
    
    for b,c in bc:
        for _ in range(b):
            p = pop(a)
            if p < c:
                push(a, c)
            else:
                # キューに戻す
                push(a, p)
                return

modify()            
print(sum(a))
### BUGGY CODE ###

N = int(input())
S = []
for _ in range(N):
    s = list(input())
    s.sort()
    s = ''.join(s)
    S.append(s)

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        if S[i] == S[j]:
            ans += 1
print(ans)


### FIXED CODE ###

from collections import Counter

N = int(input())
S = []
for _ in range(N):
    s = list(input())
    s.sort()
    s = ''.join(s)
    S.append(s)

counter = Counter(S)

ans = 0
for v in counter.values():
    ans += v * (v - 1) // 2
print(ans)
### BUGGY CODE ###

N, M = [int(s) for s in input().rstrip().split()]
pref = [[] for _ in range(N)]
P = []
for m in range(M):
    p, year = [int(s) for s in input().rstrip().split()]
    pref[p-1].append([year, m])
    pref[p-1].sort()
    P.append(p)

id = [None] * M
for n, p in enumerate(pref):
    if not p:
        continue    
    p.sort()
    for x, (year, m) in enumerate(p):
        id[m] = '{0:06d}{1:06d}'.format(n+1, x+1)

print('\n'.join(id))

### FIXED CODE ###

N, M = [int(s) for s in input().rstrip().split()]
pref = [[] for _ in range(N)]
P = []
for m in range(M):
    p, year = [int(s) for s in input().rstrip().split()]
    pref[p-1].append([year, m])
    P.append(p)

id = [None] * M
for n, p in enumerate(pref):
    if not p:
        continue    
    p.sort()
    for x, (year, m) in enumerate(p):
        id[m] = '{0:06d}{1:06d}'.format(n+1, x+1)

print('\n'.join(id))
### BUGGY CODE ###

a, b, k = map(int, input().split())
for i in range(a, b+1) :
        if a <= i < a + k or b - k < i :
                print(i)

### FIXED CODE ###

a, b, k = map(int, input().split())
if k > (b - a)//2 :
	for i in range(a, b+1) :
		print(i)   
	exit()
for i in range(a, a + k) :          
	if a <= i < a + k :
		print(i)
for i in range(b - k, b + 1) :
	if b - k < i and a + k <= i:
		print(i)
### BUGGY CODE ###

s = input()
K = int(input())

substring = []
for length in range(1,len(s)+1):
    for start in range(0,len(s)+1-length):
        substring.append(s[start:start+length])

substring_uniq = list(set(substring))
substring_uniq.sort()
print(substring_uniq[K-1])

### FIXED CODE ###

s = input()
K = int(input())

substring = []
for length in range(1,6):
    for start in range(0,len(s)+1-length):
        substring.append(s[start:start+length])

substring_uniq = list(set(substring))
substring_uniq.sort()
print(substring_uniq[K-1])
### BUGGY CODE ###

n = int(input())
S = map(int,raw_input().split())
q = int(input())
T = map(int,raw_input().split())
count = 0
lst = []
for v in S:
    if v in lst:
        pass
    else:
        for i in range(q):
            if T[i] == v:
                count += 1
                break
    lst.append(v)
print count

### FIXED CODE ###

n = int(input())
S = set(raw_input().split())
q = int(input())
T = set(raw_input().split())
print len(S&T)
### BUGGY CODE ###

x,y,z,k=map(int,input().split())
a=sorted([int(i) for i in input().split()])
b=sorted([int(i) for i in input().split()])
c=sorted([int(i) for i in input().split()],reverse=True)
ab=[]
for i in range(x):
    for j in range(y):
        ab.append(a[i]+b[j])
ab.sort(reverse=True)
ab=ab[:k]
l=len(ab)
abc=[]
for i in range(l):
    for j in range(z):
        abc.append(ab[i]+c[j])
abc.sort(reverse=True)
for i in range(k):
    print(abc[i])


### FIXED CODE ###

import heapq
x,y,z,k=map(int,input().split())
#heapqは小さい順にしか並べられないので、-をつければ大きい順になる
a=sorted([-int(i) for i in input().split()])
b=sorted([-int(i) for i in input().split()])
c=sorted([-int(i) for i in input().split()])
check=set()
ans=[]
heapq.heappush(ans,(a[0]+b[0]+c[0],0,0,0))
check.add((0,0,0))
for i in range(k):
    h=heapq.heappop(ans)
    print(-h[0])
    if h[1]+1<x:
        if (h[1]+1,h[2],h[3]) not in check:
            heapq.heappush(ans,(a[h[1]+1]+b[h[2]]+c[h[3]],h[1]+1,h[2],h[3]))
            check.add((h[1]+1,h[2],h[3]))
    if h[2]+1<y:
        if (h[1],h[2]+1,h[3]) not in check:
            heapq.heappush(ans,(a[h[1]]+b[h[2]+1]+c[h[3]],h[1],h[2]+1,h[3]))
            check.add((h[1],h[2]+1,h[3]))
    if h[3]+1<z:
        if (h[1],h[2],h[3]+1) not in check:
            heapq.heappush(ans,(a[h[1]]+b[h[2]]+c[h[3]+1],h[1],h[2],h[3]+1))
            check.add((h[1],h[2],h[3]+1))
'''
while len(ans)!=0:
    print(heapq.heappop(ans)[0])
'''
### BUGGY CODE ###

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

ans = 0
for i in range(N):
    ans ^= A[i]

for i in range(N):
    A[i] = (~ans)&A[i]
    A[i] *= -1

heapq.heapify(A)
b = []

M = -heapq.heappop(A)
while A:
    m = -heapq.heappop(A)
    if m == 0:
        break
    if len(bin(M)) == len(bin(m)):
        m ^= M
        heapq.heappush(A,-m)
    else:
        b.append(M)
        M = m
b.append(M)

b = b[::-1]
ans_ = 0
for i in range(len(b)):
    M = b[i]
    for j in range(i+1,len(b)):
        m = b[j]
        if len(bin(M))==len(bin(M&m)):
            b[j] ^= M
    ans_ ^= M

ans += ans_*2
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
ans = 0
for a in A:
    ans ^= a
M = 2**60-1
b = M^ans
for i in range(N):
    A[i] &= b
A.sort(reverse=True)
for i in range(min(60,N)):
    a = A[i]
    if a == 0:
        break
    l = len(bin(a))-3
    for j in range(N):
        if j==i:
            continue
        if A[j]//2**l%2==1:
            A[j] ^= a
        else:
            if i < j:
                break
    A.sort(reverse=True)
s = 0
for a in A:
    s ^= a
ans += 2*s
print(ans)
### BUGGY CODE ###

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

tmpList=QsList[:]
tmpList.sort()

cnt=0
tmp=0
AnsList=QsList[:]
for i in QsList:
  tmp=int(QsList.index(i))+1
  a=int(tmpList.index(i))
  a=int(a)
  AnsList[a]=tmp
  
print(*AnsList)

### FIXED CODE ###

n=int(input())
a = list(map(int,input().split()))
enumerate(a,1)
b=sorted(range(len(a)), key=lambda k: a[k])
for i in range(len(b)):
  print(b[i]+1)
### BUGGY CODE ###


N = int(input())
S = [input() for _ in range(N)]

import sys
import queue

def getVlist(x):
    reslist = []
    for i in range(N):
        if int(S[x][i]): reslist.append(i)
    return reslist

ans = 0
adj_list = [[]for _ in range(N)]
for i in range(N):
    for j in range(i+1,N):
        if int(S[i][j]):
            adj_list[i].append(j)
            adj_list[j].append(i)


for kk in range(N):
    q = queue.Queue()
    visited = [False] * N
    cnt = 1
    visited[kk] = True
    q.put(kk)
    VC = 1
    while VC < N:
        nextv = []
        while not(q.empty()):
            nextv.append(q.get())
        nextv = list(set(nextv))
        #子の要素同士の連結チェック
        L = len(nextv)
        for i in range(L):
            if not(visited[nextv[i]]):
                visited[nextv[i]] = True
                VC += 1
            for j in range(i+1,L):
                if (int(S[nextv[i]][nextv[j]])):
                    print(-1)
                    sys.exit()
        
        for nv in nextv:
            for v in adj_list[nv]:
                if not(visited[v]):
                    q.put(v)
    
        cnt += 1
    
    ans = max(ans,cnt-1)
        
#
print(ans)


### FIXED CODE ###


N = int(input())
S = [input() for _ in range(N)]

import sys
import copy

ans = 0
adj_list = [[]for _ in range(N)]
for i in range(N):
    for j in range(i+1,N):
        if int(S[i][j]):
            adj_list[i].append(j)
            adj_list[j].append(i)


for kk in range(N):
    q = []
    visited = [False] * N
    cnt = 1
    visited[kk] = True
    q.append(kk)
    VC = 1
    while VC < N:
        nextv = copy.copy(q)
        q = []
        nextv = list(set(nextv))
        #子の要素同士の連結チェック
        L = len(nextv)
        for i in range(L):
            if not(visited[nextv[i]]):
                visited[nextv[i]] = True
                VC += 1
            for j in range(i+1,L):
                if (int(S[nextv[i]][nextv[j]])):
                    print(-1)
                    sys.exit()
        
        for nv in nextv:
            for v in adj_list[nv]:
                if not(visited[v]):
                    q.append(v)
    
        cnt += 1
    
    ans = max(ans,cnt-1)
        
#
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
a.append(0)
a.insert(0, 0)
inter = []

for i in range(n+1):
    inter.append(abs(a[i]-a[i+1]))

for j in range(n):
    diff = inter[j]+inter[j+1]-abs(a[j]-a[j+2])
    ans = sum(inter)-diff
    print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a.append(0)
a.insert(0, 0)
inter = []

for i in range(n+1):
    inter.append(abs(a[i]-a[i+1]))

SUM = sum(inter)

for j in range(n):
    diff = inter[j]+inter[j+1]-abs(a[j]-a[j+2])
    ans = SUM-diff
    print(ans)
### BUGGY CODE ###

def quicksort(x):
    if x==[]: return []
    smallerSorted = quicksort([a for a in x[1:] if a <= x[0]])
    biggerSorted = quicksort([a for a in x[1:] if a > x[0]])
    return smallerSorted+[x[0]]+biggerSorted
N, K = map(int, input().split())
a = list(map(int, input().split()))
if N == K:
    print(0)
else:
    l = set(a)
    bucket = quicksort([a.count(i) for i in l])
    print(sum(bucket[0:len(bucket) - K:]))

### FIXED CODE ###

from collections import Counter
N, K = map(int, input().split())
a = Counter(list(map(int, input().split())))
if N == K:
    print(0)
else:
    num = list(a.values())
    if len(num) <= K:
        print(0)
    else:
        print(sum(sorted(num)[:-K]))
### BUGGY CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, M, S = mapint()
query = [[(-1, -1)]*N for _ in range(N)]
for _ in range(M):
    u, v, a, b = mapint()
    query[u-1][v-1] = (a, b)
    query[v-1][u-1] = (a, b)
exchange = [list(mapint()) for _ in range(N)]

inf = 10**18
dp = [[inf]*(N*50) for _ in range(N)]
dp[0][0] = 0

import heapq
queue = [(0, 0, S)]
checked = [0]*N
cnt = 0

while queue:
    t, now, coin = heapq.heappop(queue)
    if cnt==N:
        break
    if not checked[now]:
        checked[now] = 1
        cnt += 1
    rate, time = exchange[now]
    if coin<N*50:
        i = 0
        while coin+rate*i<N*50:
            if t+i*time<dp[now][coin+rate*i]:
                dp[now][coin+rate*i] = t+i*time
                for nx in range(N):
                    a, b = query[now][nx]
                    if a!=-1 and coin+rate*i>=a and dp[nx][coin+rate*i-a]>t+i*time+b:
                        heapq.heappush(queue, (t+i*time+b, nx, coin+rate*i-a))
            i += 1
    else:
        coin = N*50-1
        if t<dp[now][coin]:
            dp[now][coin] = t
            for nx in range(N):
                a, b = query[now][nx]
                if a!=-1 and coin>=a and dp[nx][coin-a]>t+b:
                    heapq.heappush(queue, (t+b, nx, coin-a))  

for i in range(1, N):
    print(min(dp[i]))
        


### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, M, S = mapint()
S = min(S, N*50)
query = [[[] for _ in range(N*50+1)] for _ in range(N)]
for _ in range(M):
    u, v, a, b = mapint()
    for coin in range(a, N*50+1):
        query[u-1][coin].append((v-1, a, b))
        query[v-1][coin].append((u-1, a, b))
for i in range(N):
    c, d = mapint()
    for coin in range(N*50+1):
        query[i][coin].append((i, -c, d))

inf = 10**18
dp = [[inf]*(N*50+1) for _ in range(N)]
dp[0][0] = 0

import heapq
queue = [(0, 0, S)]
checked = [0]*N
cnt = 0

while queue:
    t, now, coin = heapq.heappop(queue)
    if cnt==N:
        break
    if not checked[now]:
        checked[now] = 1
        cnt += 1
    qlis = query[now][coin]
    for nx, a, b in qlis:
        if 0<=coin-a:
            coin = min(coin, N*50+a)
            if t+b<dp[nx][coin-a]:
                dp[nx][coin-a] = t+b
                heapq.heappush(queue, (t+b, nx, coin-a))

for i in range(1, N):
    print(min(dp[i]))
### BUGGY CODE ###


def main():
    n = int(input())
    p = list(map(int, input().split(" ")))
    ans = 0
    for i in range(n):
        if p[i] <= min(p[:i+1]):
            ans += 1
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###


def main():
    n = int(input())
    p = list(map(int, input().split(" ")))
    ans = 0
    min = 2e5+1
    for i in range(n):
        if min > p[i]:
            min = p[i]
        if p[i] <= min:
            ans += 1
    print(ans)

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

from math import sqrt
from sys import stdin
def isprime(n):
    if n == 1:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for i in range(3, int(sqrt(n))+1):
        if n % i == 0:
            return False
    return True

for n in stdin:
    n = int(n)
    ct = 0
    for i in range(1,n + 1):
        if isprime(i):
            #print (i)
            ct += 1
    print (ct)

### FIXED CODE ###

from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))
### BUGGY CODE ###

N,M=map(int, input().split())
L=[ [] for _ in range(N)]
Y=[]
X=[]
for _ in range(M):
    a,b =map(int, input().split())
    L[a-1].append(b)
    X.append({a:b})
for _ in range(N) :
    Y.append(sorted(L[_]))
for i in range(M) :
    for k,v in X[i].items():
        z='%06d' % (Y[k-1].index(v)+1)
        Z='%06d' % k
        print(Z+z)

### FIXED CODE ###

N,M = map(int,input().split())
L = []
for i in range(M):
    l = list(map(int,input().split()))+[i]
    L.append(l)
cnt = 0
tmp = []
M = sorted(L,key = lambda x: (x[0],x[1]))
for x in M:
    if tmp == x[0]:
        x.append(cnt+1)
        cnt += 1
    else:
        tmp = x[0]
        cnt = 0
        x.append(cnt)
M = sorted(L,key = lambda x:x[2])
#print(M)
for x in M:
    st = str(x[0]).zfill(6)
    st += str(x[3]+1).zfill(6)
    print(st)
### BUGGY CODE ###

X=int(input())
for A in range(-X,X):
  for B in range(-X,X):
    if A*A*A*A*A-B*B*B*B*B==X:
      print(A,B)
      exit()

### FIXED CODE ###

X=int(input())
for A in range(-120,120):
  for B in range(-120,120):
    if A**5-B**5==X:
      print(A,B)
      exit()
### BUGGY CODE ###

f = lambda: list(map(int,input().split()))
def s(l,m):
    ans = 0
    for i in range(len(l)):
        ans += l[i]
        ans %= m
    return ans

n,m = f()
a = f()
a = [s(a[:i],m) for i in range(n+1)]
ans = 0
from collections import Counter
for v in Counter(a).values():
    ans += v*(v-1)//2
print(ans)

### FIXED CODE ###

f = lambda: list(map(int,input().split()))

n,m = f()
a = f()
b = [0]
for i in range(n):
    b.append((b[-1]+a[i])%m)

ans = 0
from collections import Counter
for v in Counter(b).values():
    ans += v*(v-1)//2
print(ans)