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

import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, q = na()
s = input()
for i in range(q):
    l, r = na()
    print(s[l-1:r].count("AC"))

### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, q = na()
s = input()
ct = [0] * n
for i in range(n-1):
    if s[i:i+2] == 'AC':
        ct[i+1] = 1
for i in range(n-1):
    ct[i+1] += ct[i]
for i in range(q):
    l, r = na()
    l -= 1
    r -= 1
    print(ct[r] - ct[l])
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n, m = map(int, input().split())
 
ab = [[int(x) for x in input().split()] for _ in range(n)]
 
ab.sort(key=lambda x: x[0])
 
temp = sum(ab, [])  # 疑似Flatten
a, b = temp[0::2], temp[1::2]
 
count, cost, index = 0, 0, 0

for bottle in b:
  if count + bottle < m:  
    count += bottle
    cost += a[index] * bottle
    index += 1
  else:
    cost += a[index] * (m - count)
    break

print(cost)

### FIXED CODE ###

# cf. https://rion778.hatenablog.com/entry/2019/03/10/004006
import sys
input = sys.stdin.readline
 
N, M = [int(i) for i in input().split()]
 
plices = [[int(i) for i in input().split()] for _ in range(N)]
 
plices.sort(key = lambda x:x[0])
 
m = 0
cost = 0
 
for i in range(N):
    if m < M:
      buy = min(M - m, plices[i][1])
      cost += plices[i][0] * buy
      m += buy
    else:
      break

print(cost)
### BUGGY CODE ###

a = int(input())
b = list(map(int,input().split()))
c = 1

for i in range(1,a):
  if min(b[0:i])>b[i]:
    c += 1
print(c)
      

### FIXED CODE ###

a = int(input())
b = list(map(int,input().split()))
c = 1
k = b[0]
for i in range(1,a):
  if k>b[i]:
  	
  	k = b[i]
  	c+=1
print(c)
### BUGGY CODE ###

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

d=[[0 for j in range(D+1)] for i in range(C+1)]
d[A][B]=1
for i in range(A+1,C+1):
  d[i][B] = B*d[i-1][B] % 998244353
for j in range(B+1,D+1):
  d[A][j] = A*d[A][j-1] % 998244353
 
for i in range(A+1,C+1):
  for j in range(B+1,D+1):
    d[i][j]=(j*d[i-1][j]) % 998244353 + i*d[i][j-1] % 998244353 - ((i-1)*((j-1)*d[i-1][j-1]) % 998244353)% 998244353
    
print(d[C][D] % 998244353)

### FIXED CODE ###

import sys
import numpy as np
#from functools import lru_cache
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
MOD = 998_244_353
 
def main(A, B, C, D):
	d = np.zeros((C + 1, D + 1), np.int64)
	d[A,B]=1
	for i in range(A+1,C+1):
  		d[i,B] = B*d[i-1,B] % MOD
	for j in range(B+1,D+1):
		d[A,j] = A*d[A,j-1] % MOD
 
	for i in range(A+1,C+1):
		for j in range(B+1,D+1):
			d[i,j]=((((j*d[i-1,j]) % MOD + i*d[i,j-1] % MOD) % MOD) -((i-1)*((j-1)*d[i-1,j-1] % MOD)% MOD)% MOD)
    
	return d[C,D] % MOD
          
"""    
    print(d[C][D] % MOD)
    dp = np.zeros((C + 1, D + 1), np.int64)
    dp[C, D] = 1
    for d in range(D, 0, -1):
        dp[C, d - 1] = dp[C, d] * C % MOD
    for c in range(C - 1, -1, -1):
        x = 0
        for d in range(D, -1, -1):
            dp[c, d] = (d * dp[c + 1, d] + x) % MOD
            x += dp[c + 1, d]
            x *= c
            x %= MOD
    return dp[A, B]
"""

if sys.argv[-1] == 'ONLINE_JUDGE':
    import numba
    from numba.pycc import CC
    i8 = numba.from_dtype(np.int64)
    signature = (i8, i8, i8, i8)
 
    cc = CC('my_module')
    cc.export('main', signature)(main)
    cc.compile()
 
from my_module import main
 
A, B, C, D = map(int, read().split())
print(main(A, B, C, D))
### BUGGY CODE ###

import sys
input=sys.stdin.readline
N,K,Q=map(int,input().split())
J=[int(input()) for _ in range(Q)]
for i in range(1,N+1):
    print("Yes" if K-Q+J.count(i)>0 else "No")


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,K,Q = map(int,input().split())
A = (int(x) for x in sys.stdin.read().split())

score = [K-Q] * (N+1) 
for x in A:
    score[x] += 1

answer = '\n'.join('No' if x <= 0 else 'Yes' for x in score[1:])
print(answer)
### BUGGY CODE ###


def frog2(H,N,K):
    #print(H)
    DP = [10**10]*N
    #DP = [0]*N
    DP[0] = 0
    DP[1] = abs(H[1]-H[0])
    for i in range(2,N):
        for j in range(1,K+1):
            DP[i] = chmin(DP[i],DP[i-j]+abs(H[i]-H[i-j]))
    return DP[-1]

def chmin(a,b):
    if a < b:
        return a
    else:
        return b

if __name__ == '__main__':
    N,K = map(int,input().split())
    H = list(map(int,input().split()))
    ans = frog2(H,N,K)
    print(ans)
    

### FIXED CODE ###


def frog2(H,N,K):
    #print(H)
    DP = [10**10]*N
    #DP = [0]*N
    DP[0] = 0
    DP[1] = abs(H[1]-H[0])
    for i in range(2,N):
        for j in range(1,K+1):
            DP[i] = chmin(DP[i],DP[i-j]+abs(H[i]-H[i-j]))
    return DP[-1]

def chmin(a,b):
    if a < b:
        return a
    else:
        return b

if __name__ == '__main__':
    N,K = map(int,input().split())
    H = list(map(int,input().split()))
    ans = frog2(H,N,K)
    print(ans)
### BUGGY CODE ###

k, s = list(map(int, input().split()))

kouho_list = []

for x in range(k+1):
	for y in range(k+1):
		for z in range(k+1):
			tmp_sum = x + y + z
			if tmp_sum == s:
				kouho_list.append(tmp_sum)

print(len(kouho_list))

### FIXED CODE ###

k, s = list(map(int, input().split()))

count = 0

for x in range(k+1):
	for y in range(k+1):
		z = s - (x + y)
		if 0 <= z <= k:
			count += 1

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

import numpy as np
MOD = 10 ** 9 + 7
S = input()

dp = np.zeros(13, dtype = np.int64)
dp[0] = 1

for s in S:
  prev = dp
  dp = np.zeros(13, dtype=np.int64)
  if s == '?':
    add = range(10)
  else:
    add = [int(s)]
  for x in add:
    dp[(np.arange(13) * 10 + x) % 13] += prev
  dp %= MOD
  
print(dp[5])


### FIXED CODE ###

MOD = 10 ** 9 + 7
S = input()

dp = [0] * 13
dp[0] = 1

for s in S:
  prev = [x for x in dp]
  dp = [0] * 13
  if s == '?':
    add = range(10)
  else:
    add = [int(s)]
  for i in range(13):
    for x in add:
      dp[(10*i+x)%13] += prev[i]
  dp = [x % MOD for x in dp]
  
print(dp[5])
### BUGGY CODE ###

import heapq

N = int(input())
A, B = [], []
for i in range(N):
  a,b = map(int,input().split())
  heapq.heappush(A,[-a,-b,i])
  heapq.heappush(B,[-b,-a,i])

flags = [1 for _ in range(N)]
Asum, Bsum = 0, 0
ans = 0
turn = 1
while sum(flags)>0:
  if turn == 1:
    while len(A)>0:
      neg_a, _, ii = heapq.heappop(A)
      if flags[ii] == 1:
        flags[ii] = 0
        break
    Asum += -neg_a
  else:
    while len(B)>0:
      neg_b, _, ii = heapq.heappop(B)
      if flags[ii] == 1:
        flags[ii] = 0
        break
    Bsum += -neg_b
  turn *= -1
print(Asum-Bsum)

### FIXED CODE ###

N = int(input())
AB = []
ans = 0
for _ in range(N):
  a,b = map(int,input().split())
  AB.append(a+b)
  ans -= b
AB.sort(reverse=True)

print(ans+sum(AB[::2]))
### BUGGY CODE ###

n, m = map(int, input().split())
can_open = []
cost = []
for _ in range(m):
    a, b = map(int, input().split())
    cost.append(a)
    it = map(int, input().split())
    x = 0
    for c in it:
        x += 1 << (c-1)
    can_open.append(x)

n_bit = 1 << n
INF = 10**18
dp = [[INF]*n_bit for _ in range(m+1)]
dp[0][0] = 0

# 配る
for i in range(m):
    for j in range(n_bit):
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])

        if (j | can_open[i]) <= n_bit:
            dp[i+1][j | can_open[i]
                    ] = min(dp[i+1][j | can_open[i]], dp[i+1][j]+cost[i])

print(dp[-1][-1] if dp[-1][-1] != INF else -1)


### FIXED CODE ###

n, m = map(int, input().split())
can_open = []
cost = []
for _ in range(m):
    a, b = map(int, input().split())
    cost.append(a)
    it = map(int, input().split())
    x = 0
    for c in it:
        x += 1 << (c-1)
    can_open.append(x)

n_bit = 1 << n
INF = 10**18
dp = [[INF]*n_bit for _ in range(m+1)]
dp[0][0] = 0

# 配る
for i in range(m):
    for j in range(n_bit):
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])

        if (j | can_open[i]) <= n_bit:
            dp[i+1][j | can_open[i]
                    ] = min(dp[i+1][j | can_open[i]], dp[i+1][j]+cost[i])

print(dp[-1][-1] if dp[-1][-1] != INF else -1)
### BUGGY CODE ###

N = int(input())
b = list(map(int, input().split()))
a = [1, 2, 3, 4, 5]

def f(a, ans):
    if len(a) == 0:
        for i in range(len(ans)):
            print(ans[len(ans) - i - 1])
        exit()
    for i in range(len(a)):
        if i + 1 == a[i]:
            f(a[0:i] + a[i + 1:len(a)], ans + [i + 1])

f(b, [])
print(-1)



### FIXED CODE ###

N = int(input())
b = list(map(int, input().split()))
a = [1, 2, 3, 4, 5]

def f(a, ans):
    if len(a) == 0:
        for i in range(len(ans)):
            print(ans[len(ans) - i - 1])
        exit()
    for i in range(len(a) - 1, -1, -1):
        if i + 1 == a[i]:
            f(a[0:i] + a[i + 1:len(a)], ans + [i + 1])
            break


f(b, [])
print(-1)
### BUGGY CODE ###

n,k=map(int,input().split())
li=[int(k) for k in input().split()]
tot=0
ans=0
def findans(tot,li,j,k):
    global ans
    if k-tot==0 :
        ans+=1
    
        return 1
    if k<0:
        return 0
    if j==len(li):
        return 0    
    for i in range(li[j]+1):
        
        x=findans(tot+i,li,j+1,k)
    
    
findans(0,li,0,k)
mod=10**9+7
print(ans%mod)

    

### FIXED CODE ###

n,k=map(int,input().split())
li=[int(K) for K in input().split()]
dp=[[0 for j in range(k+1)] for i in range(n+1)]
dp[0][0]=1
for b in range(1,n+1):
  dp[b][0]=1
mod=10**9+7  
for i in range(1,n+1):
  sums=[0]*(k+1)
  sums[0]=1
  for j in range(1,k+1):
    sums[j]=(sums[j-1]+dp[i-1][j])%mod
  for a in range(k+1):
    res=sums[a]
    if(a-li[i-1]-1)>=0:
      res=(res-sums[a-li[i-1]-1]+mod)%mod
    dp[i][a]=res
print(dp[n][k])
### BUGGY CODE ###

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

def dijkstra(s,n,w,cost):
    #始点sから各頂点への最短距離
    #n:頂点数,　w:辺の数, cost[u][v] : 辺uvのコスト(存在しないときはinf)
    d = [float("inf")] * n
    used = [False] * n
    d[s] = 0
    
    while True:
        v = -1
        #まだ使われてない頂点の中から最小の距離のものを探す
        for i in range(n):
            if (not used[i]) and (v == -1):
               v = i
            elif (not used[i]) and d[i] < d[v]:
                v = i
        if v == -1:
               break
        used[v] = True
               
        for j in range(n):
               d[j] = min(d[j],d[v]+cost[v][j])
    return d

################################

cost = [[float("inf") for i in range(n)] for i in range(n)] 
#cost[u][v] : 辺uvのコスト(存在しないときはinf この場合は10**10)
for i in range(n-1):
    cost[i][i+1] = 1
    cost[i+1][i] = 1
    
cost[x-1][y-1] = 1
cost[y-1][x-1] = 1

print(n)
for dis in range(2,n) :
  ans = 0
  for s in range(n) :
    ans += dijkstra(s,n,w,cost).count(dis)
  print(ans//2)

### FIXED CODE ###

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

ans = [0 for i in range(n)]
for s in range(n) :
  for g in range(s,n) :
    if s == g :
      continue
    dis = min(abs(g-s),abs(abs(x-s)+1+abs(y-g)),abs(abs(y-s)+1+abs(x-g)))
    ans[dis] += 1
    
for i in range(1,n) :
  print(ans[i])
### BUGGY CODE ###

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())
ans = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            ans += gcd(i+1, j+1, k+1)

print(ans)


### FIXED CODE ###

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

K = int(input())
ans = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            ans += gcd(i+1, j+1, k+1)

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

def div(n):
  d = set()
  for i in range(1, n+1):
    if n % i == 0:
      d.add(i)
  return d

a, b = map(int, input().split())
lc = list(div(a) & div(b))
lc.sort()
la = []
for i in lc:
  if la:
    for j in la:
      if j != 1 and i % j == 0:
        break
    else:
      la.append(i)
  else:
    la.append(i)
print(len(la))


### FIXED CODE ###

import math
def gcd(a, b):
  while b > 0:
    a, b = b, a % b
  return a
def div(a):
  r = []
  i = 2
  k = int(math.sqrt(a))
  while i <= k:
    if a % i == 0:
      r.append(i)
      while a % i == 0:
        a //= i
      k = math.sqrt(a)
    i += 1
  if a > 1:
    r.append(a)
  return r

a, b = map(int, input().split())
if a > b:
  a, b = b, a
c = gcd(a,b)
print(len(div(c))+1)
### BUGGY CODE ###

H, W, A, B = map(int, input().split())
INF = 10**9 + 7

def powmod(a, n, mod):
    p = 1
    while n > 0:
        if n % 2 == 0:
            a = a**2 % mod
            n /= 2
        else:
            p *= a
            p %= mod
            n -= 1
    return p


def invmod(a, mod):
    return powmod(a, mod-2, mod)


def combmod(n, k, mod):
    if n < k : return 0
    else:
        if n < 2*k: k = n-k
        bunsi = fac[n]
        bunbo = inv[k] * inv[n-k]
        return bunsi * bunbo % mod

fac = [1] * (H+W+1)
inv = [1] * (H+W+1)
for i in range(H+W+1):
    if i == 0:
        fac[i] = 1
        inv[i] = 1
    else:
        fac[i] = fac[i-1] * i % INF
        inv[i] = inv[i-1] * invmod(i, INF) % INF

ans = 0
for i in range(min(W, H - A + B) - B):
    h = H - A - i
    w = B + 1 + i
    ans += combmod(h+w-2, h-1, INF) * combmod(H+W-h-w, H - h, INF) % INF

print(ans%INF)

### FIXED CODE ###

H, W, A, B = map(int, input().split())
INF = 10**9 + 7

def powmod(a, n, mod):
    p = 1
    while n > 0:
        if n % 2 == 0:
            a = a**2 % mod
            n /= 2
        else:
            p *= a
            p %= mod
            n -= 1
    return p


def invmod(a, mod):
    return powmod(a, mod-2, mod)


def combmod(n, k, mod):
    if n < k : return 0
    else:
        if n < 2*k: k = n-k
        bunsi = fac[n]
        bunbo = inv[k] * inv[n-k]
        return bunsi * bunbo % mod

fac = [1] * (H+W+1)
inv = [1] * (H+W+1)
for i in range(H+W+1):
    if i == 0:
        fac[i] = 1
        inv[i] = 1
    else:
        fac[i] = fac[i-1] * i % INF
        inv[i] = inv[i-1] * invmod(i, INF) % INF

ans = 0
for i in range(min(W, H - A + B) - B):
    h = H - A - i
    w = B + 1 + i
    ans += combmod(h+w-2, h-1, INF) * combmod(H+W-h-w, H - h, INF) % INF

print(ans%INF)
### BUGGY CODE ###

n = int(input())
graph = [[] for _ in range(n + 1)]

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

que = [(1, 0)]

colors = [None] * (n + 1)
while que:
    now, color = que.pop(0)
    if colors[now] is not None:
        continue
    colors[now] = color

    for b, w in graph[now]:
        que.append((b, (color + (w & 1)) & 1))
print("\n".join(map(str, colors[1:])))


### FIXED CODE ###

n = int(input())
graph = [[] for _ in range(n + 1)]

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

que = [(1, 0)]

colors = [None] * (n + 1)
while que:
    now, color = que.pop(0)
    colors[now] = color

    for b, w in graph[now]:
        if colors[b] is not None:
            continue
        que.append((b, (color + (w & 1)) & 1))
print("\n".join(map(str, colors[1:])))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate
# from fractions import gcd

def solve():
    N = II()
    A = LI()

    q = deque(sorted(A))

    memo = {}
    for a in A:
        if memo.get(a, -1) == -1:
            memo[a] = 1
        else:
            memo[a] = 0
    # print(memo)

    ans = 0
    while q:
        # print(q)
        n = q.popleft()
        ans = ans + memo[n]
        next_q = deque([])
        for t in q:
            if t % n == 0:
                pass
            else:
                # print(n, t)
                next_q.append(t)
        q = next_q
    print(ans)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)
# input = sys.stdin.readline    ####
def int1(x): return int(x) - 1
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def MS(): return input().split()
def LS(): return list(input())
def LLS(rows_number): return [LS() for _ in range(rows_number)]
def printlist(lst, k=' '): print(k.join(list(map(str, lst))))
INF = float('inf')
# from math import ceil, floor, log2
# from collections import deque
# from itertools import combinations as comb, combinations_with_replacement as comb_w, accumulate, product, permutations
# from heapq import heapify, heappop, heappush
# import numpy as np
# from numpy import cumsum  # accumulate
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

def solve():
    N = II()
    A = LI()

    mx = max(A)

    memo = [0] * (mx + 1)
    for a in A:
        for i in range(a, mx+1, a):
            memo[i] += 1
    # print(memo)

    ans = 0
    for a in A:
        if memo[a] == 1:
            ans += 1
    print(ans)

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

class Node:
	elm = None
	next = None
	prev = None

class MyQueue:
	head = tail = None

	def enq(self, x):
		n = Node()
		n.elm = x
		if self.head == None:
			self.head = self.tail = n
		else:
			self.tail.next = n
			n.prev = self.tail
			self.tail = n

	def deq(self):
		if self.head == None:
			return None
		x = self.head.elm
		self.head = self.head.next
		if self.head: 
			self.head.prev = None
		else:
			self.tail = None
		return x

	def pop(self):
		if self.tail == None:
			return None
		x = self.tail.elm
		self.tail = self.tail.prev
		if self.tail: 
			self.tail.next = None
		else:
			self.head = None
		return x

class MyList:
	head = tail = None
	lookup = {}

	def insert(self, x):
		n = Node()
		n.elm = x
		if self.head == None:
			self.head = self.tail = n
		else:
			n.next = self.head
			self.head.prev = n
			self.head = n
		if not x in self.lookup:
			self.lookup[x] = MyQueue()
		self.lookup[x].enq(n)

	def delete(self, x):
		n = self.lookup[x].pop()
		self.__delete_node(n)

	def deleteFirst(self):
		self.lookup[self.head.elm].pop()
		self.__delete_node(self.head)

	def deleteLast(self):
		self.lookup[self.tail.elm].deq()
		self.__delete_node(self.tail)

	def __delete_node(self, n):
		if n == None: 
			return
		if n == self.head:
			self.head = n.next
		if n == self.tail:
			self.tail = n.prev
		if n.prev:
			n.prev.next = n.next
		if n.next:
			n.next.prev = n.prev

	def __traverse(self):
		n = self.head
		while n:
			yield n.elm
			n = n.next

	def __str__(self):
		return " ".join([str(s) for s in self.__traverse()])

myList = MyList()
n = int(raw_input())
for _ in xrange(n):
	line = raw_input()
	if line[0]=='i':
		myList.insert(int(line[7:]))
	elif line[6]=='F':
		myList.deleteFirst()
	elif line[6]=='L':
		myList.deleteLast()
	else:
		myList.delete(int(line[7:]))
print myList

### FIXED CODE ###

class MyList:
	head = tail = None

	def insert(self, x):
		n = [x, None, None]
		if self.head == None:
			self.head = self.tail = n
		else:
			n[2] = self.head
			self.head[1] = n
			self.head = n

	def delete(self, x):
		n = self.head
		while n and n[0] != x:
			n = n[2]
		if n: 
			self.__delete_node(n)

	def deleteFirst(self):
		self.__delete_node(self.head)

	def deleteLast(self):
		self.__delete_node(self.tail)

	def __delete_node(self, n):
		if n == self.head:
			self.head = n[2]
		if n == self.tail:
			self.tail = n[1]
		if n[1]:
			n[1][2] = n[2]
		if n[2]:
			n[2][1] = n[1]

	def print_all(self):
		n = self.head
		while n:
			print n[0],
			n = n[2]

myList = MyList()
n = int(raw_input())
for _ in xrange(n):
	line = raw_input()
	if line[0]=='i':
		myList.insert(line[7:])
	elif line[6]=='F':
		myList.deleteFirst()
	elif line[6]=='L':
		myList.deleteLast()
	else:
		myList.delete(line[7:])
myList.print_all()
### BUGGY CODE ###

N = int(input())
A=list(map(int,input().split()))
x = 1
for i in range(len(A)):
    x = x*A[i]
if x <=1e18:
    print(x)
else:
    print("-1")

### FIXED CODE ###

import numpy as np
N = int(input())
A = list(input().split())

Af =  np.array(A,dtype='float64')
Afans = np.prod(Af,dtype='float64')

if Afans == 0.:
    print('0')
elif Afans >=2e18:
    print('-1')
else:
    Ai =  np.array(A,dtype='int64')
    Aians = np.prod(Ai,dtype='int64')
    if Aians <=np.int64(1e18) and Aians >=np.int64(0):
        print(Aians)
    else:
        print("-1")
### BUGGY CODE ###

line1 = input()
line2 = input()

n, k = tuple([int(val) for val in line1.split()])
a_list = [int(val) for val in line2.split()]

prev_sum = sum(a_list[0:k])
for i in range(k, n):
    current_sum = sum(a_list[i-k+1:i+1])
    if current_sum > prev_sum:
        print("Yes")
    else:
        print("No")
    prev_sum = current_sum

### FIXED CODE ###

line1 = input()
line2 = input()

n, k = tuple([int(val) for val in line1.split()])
a_list = [int(val) for val in line2.split()]

prev_sum = sum(a_list[0:k])
for i in range(k, n):
    current_sum = prev_sum - a_list[i-k] + a_list[i]
    if current_sum > prev_sum:
        print("Yes")
    else:
        print("No")
    prev_sum = current_sum
### BUGGY CODE ###

A,B=map(int,input().split())
lst=[]
for i in range(2,int(min(A,B)+1)):
    if A%i==0 and B%i==0:
        flag=1
        for l in lst:
            if i%l==0:
                flag=0
                break
        if flag:
            A=A//i
            B=B//i
            lst.append(i)

lst+=[1]
#print(lst)
print(len(lst))


### FIXED CODE ###

A,B=map(int,input().split())
lst=set()
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

if A==B==1:
    print(1)
else:
    print(len(set([i[0] for i in factorization(A)])&set([i[0] for i in factorization(B)]))+1)
### BUGGY CODE ###

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

ans = 1
for i in range(len(a)):
    ans *= a[i]
    
if ans > 10**18:
  print(-1)
  exit()
  
print(ans)


### FIXED CODE ###

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

for i in range(len(a)):
    if a[i] == 0:
        print(0)
        exit()

ans = 1
for i in range(len(a)):
  ans *= a[i]
  if ans > 10**18:
    print(-1)
    exit()

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

n = int(input())

ans = 0
for i in range(n):
    ans += i

print(ans)


### FIXED CODE ###

n = int(input())

ans = n * (n-1) // 2

print(ans)