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

N=int(input())
A=list(map(int, input().split()))
flag=0
i=0
now=1
cnt=0
ans=0

if 1 not in A:
	print(-1)
	
else:
	while flag==0:
		if A[i]!=now:
			A.pop(i)
			cnt+=1
			ans+=1
		else:
			i+=1
			cnt+=1
			now+=1
		
		if cnt==N:
			flag=1
	
	print(ans)
		

### FIXED CODE ###

N=int(input())
A=list(map(int, input().split()))[::-1]

flag=0
i=0
now=1
cnt=0
ans=0

if 1 not in A:
	print(-1)
	
else:
	while flag==0:
		if A[-(i+1)]!=now:
			A.pop(-(i+1))
			cnt+=1
			ans+=1
		else:
			i+=1
			cnt+=1
			now+=1
		
		if cnt==N:
			flag=1
	
	print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
"""
D - Practical Skill Test
https://beta.atcoder.jp/contests/abc089/tasks/abc089_d

"""
import sys
from sys import stdin
input = stdin.readline


def sub_solve(l, r):
    sx, sy = numbers[l]
    gx, gy = numbers[r]
    return abs(sx - gx) + abs(sy - gy)


def solve(numbers, queries, H, W, D):
    dp = [[-1] * (H*W+1) for _ in range(H*W+1)]

    for l, r in queries:
        ans = 0
        while True:
            if l == r:
                break
            if dp[l][r] != -1:
                res = dp[l][r]
                ans += res
                break
            if dp[l][l+D] == -1:
                dp[l][l+D] = sub_solve(l, l+D)
            res = dp[l][l+D]
            ans += res
            l += D
        print(ans)


numbers = dict()
def main(args):
    global numbers
    H, W, D = map(int, input().split())
    board = []
    for _ in range(H):
        board.append([int(x) for x in input().split()])
    Q = int(input())
    queries = []
    for _ in range(Q):
        queries.append([int(x) for x in input().split()])

    for y, row in enumerate(board, start=1):
        for x, i in enumerate(row, start=1):
            numbers[i] = [x, y]

    solve(numbers, queries, H, W, D)


if __name__ == '__main__':
    main(sys.argv[1:])


### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
D - Practical Skill Test
https://beta.atcoder.jp/contests/abc089/tasks/abc089_d

"""
import sys
from sys import stdin
input = stdin.readline


def sub_solve(l, r):
    sx, sy = numbers[l]
    gx, gy = numbers[r]
    return abs(sx - gx) + abs(sy - gy)


def solve(queries, H, W, D):
    dp = [0] * (H*W+1)
    for i in range(D+1, H*W+1):
        dp[i] = dp[i-D] + sub_solve(i-D, i)

    for l, r in queries:
        ans = dp[r] - dp[l]
        print(ans)


numbers = dict()
def main(args):
    global numbers
    H, W, D = map(int, input().split())

    for y in range(1, H+1):
        tmp = [int(x) for x in input().split()]
        for x, i in enumerate(tmp, start=1):
            numbers[i] = (x, y)

    Q = int(input())
    queries = []
    for _ in range(Q):
        queries.append([int(x) for x in input().split()])

    solve(queries, H, W, D)


if __name__ == '__main__':
    main(sys.argv[1:])
### BUGGY CODE ###

N, M = map(int, input().split())
H = []
AB = []
H = input().split()

for _ in range(M):
    a, b = map(int, input().split())
    AB.append([a, b])

c = 0

for i in range(N):
    flg = True
    Hi = int(H[i])
    for m in range(M):
        if i + 1 in AB[m]:
            o_idx = 1 - AB[m].index(i + 1)
            otherH = int(H[AB[m][o_idx]-1])
            # print(AB[m], i+1, o_idx, otherH, Hi)
            if Hi <= otherH:
                flg = False
                break

    if flg:
        c += 1
    # print(c)

print(c)


### FIXED CODE ###

N, M = map(int, input().split())
H = [int(h) for h in input().split()]
ans = [1] * N


# print(H)

for i in range(M):
    a, b = map(int, input().split())
    AH = H[a - 1]
    BH = H[b - 1]
    # print(AH, BH)
    if AH >= BH:
        ans[b - 1] = 0
    if BH >= AH:
        ans[a - 1] = 0


print(ans.count(1))
### BUGGY CODE ###

S = input()
T = input()
X,Y = len(S),len(T)
L = [[0 for _ in range (Y+1)] for _ in range (X+1)]
for i in range (X):
  for j in range (Y):
    if S[i] == T[j]:
      L[i+1][j+1] = L[i][j]+1
    else:
      L[i+1][j+1] = max(L[i][j+1] , L[i+1][j] , L[i+1][j+1])
K = ''
while X*Y:
  if S[X-1] == T[Y-1]:
    K += S[X-1]
    X -= 1
    Y -= 1
  else:
    if L[X-1][Y] > L[X][Y-1]:
      X -= 1
    else:
      Y -= 1
print(K[::-1])

### FIXED CODE ###

S = input()
T = input()
X,Y = len(S),len(T)
L = [[0 for _ in range (Y+1)] for _ in range (X+1)]
for i in range (X):
  for j in range (Y):
    if S[i] == T[j]:
      L[i+1][j+1] = L[i][j]+1
    else:
      L[i+1][j+1] = max(L[i][j+1] , L[i+1][j] , L[i+1][j+1])
K = ''
while X*Y:
  if S[X-1] == T[Y-1]:
    K += S[X-1]
    X -= 1
    Y -= 1
  else:
    if L[X-1][Y] > L[X][Y-1]:
      X -= 1
    else:
      Y -= 1
print(K[::-1])
### BUGGY CODE ###

import numpy as np

N, Q = map(int, input().split())
S = input()
ls, rs = [], []
for _ in range(Q):
    l, r = map(int, input().split())
    ls.append(l-1)
    rs.append(r-1)

arr = np.zeros(N, np.int)
flag = False
for i in range(len(S)):
    if S[i] == 'A':
        flag = True
    elif S[i] == 'C' and flag:
        arr[i - 1] = 1
    else:
        flag = False

for l, r in zip(ls, rs):
    print(np.sum(arr[l:r]))


### FIXED CODE ###

import numpy as np

N, Q = map(int, input().split())
S = input()
ls, rs = [], []
for _ in range(Q):
    l, r = input().split()
    ls.append(int(l)-1)
    rs.append(int(r)-1)

arr = np.zeros(N, np.int)
# flag = False
# for i in range(N):
#     if S[i] == 'A':
#         flag = True
#     elif S[i] == 'C' and flag:
#         arr[i - 1] = 1
#     else:
#         flag = False
for i, (a, c) in enumerate(zip(S, S[1:])):
    if a == 'A' and c == 'C':
        arr[i] = 1

cum = np.cumsum(arr)

for l, r in zip(ls, rs):
    if l == 0:
        print(cum[r-1])
    else:
        print(cum[r-1] - cum[l-1])
### BUGGY CODE ###

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

cnt = 0
min_p = 0

if n == 1:
    print(n)
else:
    for i in range(1, n):
        min_p = min(p[:i])

        if min(p[:i]) < p[i]:
            cnt = cnt + 1
    print(n - cnt)


### FIXED CODE ###

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

cnt = 1
min_p = p[0]

if n == 1:
    print(n)
else:
    for i in range(1, n):
        if p[i] < min_p:
            min_p = p[i]
            cnt += 1
    print(cnt)
### BUGGY CODE ###

s = input()
q = int(input())

inv = False
mae = ''
usiro = ''

for _ in range(q):
    tmp = list(input().split())
    if tmp == ['1']:
        inv = not inv

    elif tmp[1] == '1' and not inv:
        mae = tmp[2] + mae
    elif tmp[1] == '2' and not inv:
        usiro = usiro + tmp[2]
    elif tmp[1] == '1' and inv:
        usiro = usiro + tmp[2]
    elif tmp[1] == '2' and inv:
        mae = tmp[2] + mae

    # print(mae,s,usiro)

ans = ''.join(mae) + s + ''.join(usiro)

if inv:
    ans = ans[::-1]

print(ans)

### FIXED CODE ###

s = input()
q = int(input())

inv = False
mae = ''
usiro = ''

for _ in range(q):
    tmp = input()
    if tmp[0] == '1':
        inv = not inv

    else:
        _,f,c = tmp.split()

        if f == '1' and not inv:
            mae += c
        elif f == '2' and not inv:
            usiro += c
        elif f == '1' and inv:
            usiro += c
        elif f == '2' and inv:
            mae += c

    # print(mae,s,usiro)

ans = mae[::-1] + s + usiro

if inv:
    ans = ans[::-1]

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

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

for i in range(M):
    Bi, Ci = map(int, input().split())
    A.extend([Ci] * Bi)

print(sum(sorted(A, reverse=True)[:N]))

### FIXED CODE ###

N, M = map(int, input().split())
A = map(int, input().split())
card = {}
for a in A:
    if a not in card:
        card[a] = 1
    else:
        card[a] += 1

for i in range(M):
    Bi, Ci = map(int, input().split())
    if Ci not in card:
        card[Ci] = Bi
    else:
        card[Ci] += Bi

total = 0
count = 0
for num in sorted(card.keys(), reverse=True):
    if count + card[num] <= N:
        count += card[num]
        total += num * card[num]
    else:
        added = N - count
        count += added
        total += added * num
        break
print(total)
### BUGGY CODE ###

def prime(n):
    if (n==2):
        return True
    elif(n == 1):
        return False
    else:
        pr = [2]
        for i in range(3,n):
            c = 0
            for p in pr:
                if (i % p != 0):
                    c = c + 1
            if (c == len(pr)):
                pr.append(i)
        cc = 0        
        for p in pr:
            if(n%p != 0):
                cc = cc + 1
    
    if(cc == len(pr)):
        return True
    else:
        return False
        
    
N = int(input())

count = 0
for i in range(N):
    n = int(input())
    if prime(n) == True:
        count = count + 1 
print(count)   
   


### FIXED CODE ###

n = int(input())
mlist = []
plist = [2]
for i in range(3,10000):
    count = 0
    for k in plist:
        if (i%k != 0):
            count += 1
        else:
            break
    if (count == len(plist)):
        plist.append(i)
def check(m):
    for p in plist:
        if (m <= p):
            return True
        if m%p == 0:
            return False     ##한번이라도 False가 return되면 False가 되기에 prime인지 아닌지 check가능
    return True

count = 0
for i in range(n):
    m = int(input())
    if check(m):
        count += 1
        
print(count)
### BUGGY CODE ###

N = int(input())
A = [int(x) for x in input().split()]
Q = int(input())
array = []
for i in range(Q):
    m,n = [int(x) for x in input().split()]
    array.append([m,n])
operation = []
for i in range(len(array)):
    for j in range(len(A)):
        if array[i][0] == A[j]:
            A[j] = array[i][1]
    print(sum(A))


### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]
Q = int(input())
array = []
replace = [0]*(10**5+1)
for i in A:
    replace[i] += 1
sum_s = sum(A)
for i in range(Q):
    m,n = [int(x) for x in input().split()]
    replace[n] += replace[m]

    diff = n*replace[m] - replace[m]*m
    sum_s += diff
    replace[m] = 0
    print(sum_s)
### BUGGY CODE ###

N,K = map(int,input().split())
h = list(map(int,input().split()))
dp = [0]*N

#iは知りたいdp[i]
for i in range(1,N):
    #for j in range(max(i-K,0),i)はジャンプできる段数
    dp[i] = min(dp[j]+abs(h[j]-h[i]) for j in range(max(i-K,0),i))
print(dp[N-1])

### FIXED CODE ###

N,K = map(int,input().split())
h = list(map(int,input().split()))

dp = [0]*N

#iは知りたいdp[i]
for i in range(1,N):
    #for j in range(max(i-K,0),i)はジャンプできる段数
    dp[i] = min(dp[j]+abs(h[j]-h[i]) for j in range(max(i-K,0),i))
print(dp[N-1])
### BUGGY CODE ###

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

# 入力
N, K = map(int, input().split())
H = [int(i) for i in input().split()]

# メモ用のDPテーブル生成
dp = [float("inf") for i in range(N)]

# 初期値をセット
dp[0] = 0

# 足場iへたどり着く最小コストを返す
def rec(i):
    # ベースケース
    if i == 0:
        return 0
    
    # メモをチェック
    if dp[i] < float("inf"):
        return dp[i]
    
    # 足場iの最小コストの更新
    # for j in range(1, K+1):
        # if i - j >= 0:
            # 最小コストをメモ
            # dp[i] = min(dp[i], rec(i-j) + abs(H[i] - H[i-j]))
            
    dp[i] = min([rec(i-j) + abs(H[i] - H[i-j]) for j in range(1, K+1) if i - j >= 0])
    
    return dp[i]

print(rec(N-1))

### FIXED CODE ###

import numpy as np

# 入力
N, K = map(int, input().split())
H = np.array([int(i) for i in input().split()])

# ndarray型のDPテーブルを生成
dp = np.zeros(N, dtype=int)
# 初期値をセット
dp[0] = 0

# 各足場へたどり着く最小コストを調べる
for i in range(1, N):
    s = max(0, i-K)
    dp[i] = min(dp[s:i] + np.abs(H[i] - H[s:i])) # iより前の足場のコストに足す

print(dp[N-1])
### BUGGY CODE ###

import sys
import numpy as np
from math import ceil as C, floor as F, sqrt
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
 
ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

_, k = Is()
towns = [i-1 for i in Is()]

now = 0
seen = [0]
seenx = {0: 0}

while k > 0:
  k -= 1
  now = towns[now]
  
  if now not in seen:
    seen.append(now)
    seenx[now] = len(seen) - 1
  else:
    seen = seen[seenx[now]:]
    break
    
    
if k == 0:
  print(1 + now)
else:
  print(1 + (seen[k % len(seen)]))

### FIXED CODE ###

import sys
import numpy as np
from math import ceil as C, floor as F, sqrt
from collections import defaultdict as D, Counter as CNT
from functools import reduce as R
 
ALP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
alp = 'abcdefghijklmnopqrstuvwxyz'
def _X(): return sys.stdin.readline().rstrip().split(' ')
def _S(ss): return tuple(ss) if len(ss) > 1 else ss[0]
def S(): return _S(_X())
def Ss(): return list(S())
def _I(ss): return tuple([int(s) for s in ss]) if isinstance(ss, tuple) else int(ss)
def I(): return _I(S())
def _Is(ss): return list(ss) if isinstance(ss, tuple) else [ss]
def Is(): return _Is(I())

_, k = Is()
towns = [i-1 for i in Is()]

now = 0
seen = [0]
seenx = {0: 0}

while k > 0:
  k -= 1
  now = towns[now]
  
  if now not in seenx:
    seenx[now] = len(seen)
    seen.append(now)
  else:
    seen = seen[seenx[now]:]
    break

if k == 0:
  print(1 + now)
else:
  print(1 + (seen[k % len(seen)]))
### BUGGY CODE ###

S = input()
N = len(S)
K = int(input())

S1 = {}
for i, s in enumerate(S):
    if not s in S1.keys():
        S1[s] = [i]
    else:
        S1[s].append(i)
alp = sorted(list(S1.keys()))

c = 0
for a in alp:
    aset = set()
    inds = S1[a]
    for d in inds:
        for i in range(N-d+1):
            aset.add(S[d:d+i])
    L = len(aset)-1
    if L >= K-c:
        break
    c += L


for _ in range(10):
    min = '何だこれはもうやめてくれよ'
    for a in aset:
        if a < min:
            min = a
    aset.discard(min)
    if min == '':
        continue
    c += 1
    if c >= K:
        ans = min
        break

print(ans)

### FIXED CODE ###

def main():
    S = input()
    N = len(S)
    K = int(input())

    S1 = {}
    for i, s in enumerate(S):
        if not s in S1.keys():
            S1[s] = [i]
        else:
            S1[s].append(i)
    alp = sorted(list(S1.keys()))

    c = 0
    for a in alp:
        aset = set()
        inds = S1[a]
        for d in inds:
            up = min(N-d+1, K+1)
            for i in range(up):
                aset.add(S[d:d+i])
        L = len(aset)-1
        if L >= K-c:
            break
        c += L

    for _ in range(10):
        M = '何だこれはもうやめてくれよ'
        for a in aset:
            if a < M:
                M = a
        aset.discard(M)
        if M == '':
            continue
        c += 1
        if c >= K:
            ans = M
            break

    print(ans)



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

N = int(input())
Counted = []
num = []
 
for i in range(N):
  S = input()
  if S in Counted:
    num[Counted.index(S)] += 1
  else:
    Counted.append(S)
    num.append(1)

Dict = list(zip(Counted, num))
Dict_sorted = sorted(Dict,key=lambda x: x[1], reverse = True)
 
VVV = []
 
for i in range(len(Dict_sorted)):
  if Dict_sorted[i][1] == Dict_sorted[0][1]:
    VVV.append(Dict_sorted[i][0])
  else:
    break

SSS = sorted(VVV)
 
for _ in range(len(SSS)):
  print(SSS[_])

### FIXED CODE ###

N = int(input())
dic = {}
Max = 1

for _ in range(N):
  S = input()
  if not S in dic:
    dic[S] = 1
  else:
    dic[S] += 1
    Max = max([Max, dic[S]])

ans = []
    
for x in dic:
  if dic[x] == Max:
    ans.append(x)

ans_sorted = sorted(ans)
for y in range(len(ans)):
  print(ans_sorted[y])
### BUGGY CODE ###

n=int(input())
l=list(map(int,input().split()))
ans=1;
x=10**18
for i in range(0,n):
    if(l[i]!=0):
        ans=ans*l[i]
    else:
        ans=0
        break;
if(ans>x):
    ans=-1
print(ans)



### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
mod=1000000000000000000
ans=1
p=1
if(l.count(0)>=1):
    ans=0
else:
    for i in range(0,n):
        x=l[i]
        p=p*x
        if(p>mod):
            ans=-1
            break
if(ans!=0 and ans!=-1):
    ans=p
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np
import bisect

# いっこ入力
n =int(input())

# n行の数をリストへ
a = [int(input()) for i in range(n)] 

# color
c = [a[0]]

for i in range(1,n):
#    print(c)
#    print(p)
    if c[0] >= a[i]:
        c.insert(0,a[i])
    else:
        p = bisect.bisect_left(c, a[i])
        c[p-1]=a[i]
#        c.sort()

print(len(c))


### FIXED CODE ###

# -*- coding: utf-8 -*-
# 
import math
import sys
import bisect

# いっこ入力
n =int(input())

# n行の数をリストへ
a = [int(input()) for i in range(n)] 

# color
c = [-999]*n

for i in range(0,n):
#    if c[0] >= a[i]:
#        c.insert(0,a[i])
#    else:
    p = bisect.bisect_left(c, a[i])
    c[p-1]=a[i]
#        print(c)
#        print(p)

print(len(c) - bisect.bisect_left(c, -1))
### BUGGY CODE ###

# import bisect
# from collections import Counter, deque # https://note.nkmk.me/python-scipy-connected-components/
# from copy import copy, deepcopy
# from functools import reduce
# from heapq import heapify, heappop, heappush
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import string
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()


def resolve():
    N = int(input())

    i = 0
    print(i, flush=True)
    s = str(input())
    if s == 'Vacant':
        sys.exit()
    else:
        temp = s

    i = N // 2
    print(i, flush=True)
    s = str(input())
    if s == 'Vacant':
        sys.exit()
    elif s == 'Male':
        if i % 2 == 1 and temp != 'Male':
            temp = s
            pl, pr = 0, N // 2
        else:
            temp = s
            pl, pr = N // 2 + 1, N
    else:
        if i % 2 == 1 and temp != 'Female':
            temp = s
            pl, pr = 0, N // 2
        else:
            temp = s
            pl, pr = N // 2 + 1, N

    while pl <= pr:
        pc = (pl + pr) // 2
        print(pc, flush=True)

        s = str(input())
        if s == 'Vacant':
            sys.exit()
        elif s == 'Male':
            if (pr - pl) % 2 == 1 and temp != 'Male':
                temp = s
                pr = pc - 1
            else:
                temp = s
                pl = pc + 1
        else:
            if (pr - pl) % 2 == 1 and temp != 'Female':
                temp = s
                pr = pc - 1
            else:
                temp = s
                pl = pc + 1


resolve()


### FIXED CODE ###

N = int(input())


def query(i):
    print(i)
    s = input()
    if s == 'Vacant':
        exit()
    return s


root = query(0)


def is_ok(ind):
    # 左ならTrue
    response = query(ind)
    if ind % 2 == 1:
        return root == response
    else:
        return root != response


def bin_search_meguru():
    """
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng, okは,とり得る最小の値-1,とり得る最大の値+1
    """

    # 適当にいじる
    ng = -1  # ind=0が条件を満たすこともあるため
    ok = N  # ind=len(a)-1が条件を満たさないこともあるため

    # いじらない
    # okとngのどちらが大きいかわからないことを考慮
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return False


bin_search_meguru()
### BUGGY CODE ###

def solve(m, A):
    if A[0] == m: return True
    if len(A)==1: return False
    if m < A[0] : return solve(m, A[1:])
    if solve(m-A[0], A[1:]):
        return True
    return solve(m, A[1:])

if __name__=='__main__':
    n=int(input()) 
    A=list(map(int,input().split()))
    q=int(input()) 
    Q=list(map(int,input().split()))
    for m in Q:
        if solve(m,A): print('yes') 
        else         : print('no') 

### FIXED CODE ###

def solve(m, A):
    if A[0] == m: return True
    if len(A)==1: return False
    if m < A[0] : return solve(m, A[1:])
    if solve(m-A[0], A[1:]):
        return True
    return solve(m, A[1:])

if __name__=='__main__':
    n=int(input()) 
    A=list(map(int,input().split()))
    q=int(input()) 
    Q=list(map(int,input().split()))
    for m in Q:
        if   m > sum(A): print('no')
        elif solve(m,A): print('yes') 
        else           : print('no')
### BUGGY CODE ###

def main():
    x = int(input())
    
    if x ==1:
        print(1,0)
        return
    for i in range(-int(x**0.2),10**7,1):
        t = pow(i**5+x,1/5)
        if t.is_integer():
            print(int(t),i)
            break
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    x = int(input())
    
    if x ==1:
        print(1,0)
        return
    for i in range(-1000,1000):
        for j in range(-1000,1000):
          if i**5 - j**5 == x:
            print(i,j)
            return

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


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

import copy 
N, K, C=map(int, input().split())
s=list(input())


for i in range(N):
    if s[i]=='o':
        si=copy.copy(s)
        si[i]='x'
        day=N
        count=0
        flag=False
        while day>0 and day>=K-count and count<K:
            if si[day-1]=='x':
                day-=1
            else:
                count+=1
                day-=C+1
                if count==K:
                    flag=True
        if flag==False:
            print(i+1)
            



### FIXED CODE ###


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

import numpy as np
N, K, C=map(int, input().split())
s=list(input())

forward=np.zeros(K)
back=np.zeros(K)

day=0
count=0
while day <N and count<K:
    if s[day]=='o':
        forward[count]=day
        count+=1
        day+=C+1
    else:
        day+=1

day=N-1
count=0
while day<N and count<K:
    if s[day]=='o':
        back[count]=day
        count+=1
        day-=C+1
    else:
        day-=1

#print(forward)
#print(back[::-1])

for i in range(K):
    if forward[i]==back[K-1-i]:
        print(int(forward[i])+1)
### BUGGY CODE ###

N, M = map(int, input().split())
A_LIST = sorted(map(int, input().split()))
C_LIST = []
for i in range(M):
    b, c = map(int, input().split())
    for _ in range(b):
        C_LIST.append(c)
C_LIST.sort(reverse=True)
ans = 0
for i in range(N):
    ans += max(A_LIST[i], C_LIST[i]) if len(C_LIST) > i else A_LIST[i]
print(ans)


### FIXED CODE ###

import heapq

N, M = map(int, input().split())
A_LIST = list(map(int, input().split()))
BC_LIST = []
heapq.heapify(A_LIST)
for i in range(M):
    b, c = map(int, input().split())
    BC_LIST.append([b, c])
BC_LIST.sort(reverse=True, key=lambda x: x[1])  # C降順にソート
for b, c in BC_LIST:
    for _ in range(b):
        tmp = heapq.heappop(A_LIST)
        if tmp < c:
            heapq.heappush(A_LIST, c)
        else:
            heapq.heappush(A_LIST, tmp)
            break
print(sum(A_LIST))
### BUGGY CODE ###

n = int(input())

s = []
for _ in range(n):
    s.append(sorted(input()))

cnt = 0
for i in range(1, n):
    for j in range(i):
        if s[j] == s[i]:
            cnt += 1

print(cnt)



### FIXED CODE ###

from collections import Counter

def list2str(l):
    s = ""
    for c in l:
        s += c
    return s

n = int(input())

s = []
for _ in range(n):
    s.append(list2str(sorted(input())))

"""
# TLE
cnt = 0
for i in range(1, n):
    for j in range(i):
        if s[j] == s[i]:
            cnt += 1
"""

print(sum([x * (x - 1) // 2 for x in Counter(sorted(s)).values()]))