Allen wants to enter a fan zone that occupies a round square and has $n$ entrances.

There already is a queue of $a_i$ people in front of the $i$-th entrance. Each entrance allows one person from its queue to enter the fan zone in one minute.

Allen uses the following strategy to enter the fan zone:   Initially he stands in the end of the queue in front of the first entrance.  Each minute, if he is not allowed into the fan zone during the minute (meaning he is not the first in the queue), he leaves the current queue and stands in the end of the queue of the next entrance (or the first entrance if he leaves the last entrance). 

Determine the entrance through which Allen will finally enter the fan zone.


-----Input-----

The first line contains a single integer $n$ ($2 \le n \le 10^5$) — the number of entrances.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($0 \le a_i \le 10^9$) — the number of people in queues. These numbers do not include Allen.


-----Output-----

Print a single integer — the number of entrance that Allen will use.


-----Examples-----
Input
4
2 3 2 0

Output
3

Input
2
10 10

Output
1

Input
6
5 2 6 5 7 4

Output
6



-----Note-----

In the first example the number of people (not including Allen) changes as follows: $[\textbf{2}, 3, 2, 0] \to [1, \textbf{2}, 1, 0] \to [0, 1, \textbf{0}, 0]$. The number in bold is the queue Alles stands in. We see that he will enter the fan zone through the third entrance.

In the second example the number of people (not including Allen) changes as follows: $[\textbf{10}, 10] \to [9, \textbf{9}] \to [\textbf{8}, 8] \to [7, \textbf{7}] \to [\textbf{6}, 6] \to \\ [5, \textbf{5}] \to [\textbf{4}, 4] \to [3, \textbf{3}] \to [\textbf{2}, 2] \to [1, \textbf{1}] \to [\textbf{0}, 0]$.

In the third example the number of people (not including Allen) changes as follows: $[\textbf{5}, 2, 6, 5, 7, 4] \to [4, \textbf{1}, 5, 4, 6, 3] \to [3, 0, \textbf{4}, 3, 5, 2] \to \\ [2, 0, 3, \textbf{2}, 4, 1] \to [1, 0, 2, 1, \textbf{3}, 0] \to [0, 0, 1, 0, 2, \textbf{0}]$.

Difficulty: EASY
Tags: Sorting

Mathematics
Skill types: Sorting
Expected Time Complexity: O(NLOG(N))

Starter code:

Solutions:
def check(midd, i):
	if midd * n + i >= arr[i]:
		return True
	return False
n = int(input())
arr = list(map(int, input().split()))
pre_cnt = 10 ** 18
ans = 10 ** 18
for i in range(n):
	l = 0
	r = 10 ** 9
	cnt = 10 ** 18
	while l <= r:
		mid = (l + r) // 2
		if check(mid, i):
			cnt = mid
			r = mid - 1
		else:
			l = mid + 1
	if cnt < pre_cnt:
		pre_cnt = cnt
		ans = i
print(ans + 1)


n = int(input())
a = list(map(int, input().split()))
ans = 0
flag = 0
while True:
	for i in range(n):
		if a[i] <= i:
			flag = 1
			ans = i
			break
	if flag:
		print(ans + 1)
		exit()
	mina = min(a)
	if n > mina:
		minus = n
	else:
		minus = mina // n * n
	for i in range(n):
		a[i] -= min(a[i], minus)


n = int(input())
a = [int(i) for i in input().split()]
i = min(a)
while a[i % n] > i:
	i += 1
print(i % n + 1)


n = int(input())
queue = list(map(int, input().split()))
rem = 0
moves = []
i = 0
for i in range(n):
	temp = queue[i] - i
	j = temp // n
	if temp % n:
		j += 1
	moves.append(j)
print(moves.index(min(moves)) + 1)


import time
import math
n = int(input())
a = [int(i) for i in input().split()]
start = time.time()
min = math.ceil(a[0] / n)
mini = 0
for i in range(n):
	a[i] = math.ceil((a[i] - i) / n)
	if min > a[i]:
		mini = i
		min = a[i]
print(mini + 1)
finish = time.time()


n = int(input())
a = [int(i) for i in input().split()]
i = 0
s = 0
t = a[0] // n
for k in range(1, n):
	if a[k] // n < t:
		t = a[k] // n
for k in range(n):
	a[k] -= t * n
while a[i] - s > 0:
	s += 1
	if i == n - 1:
		i = 0
	else:
		i += 1
print(i + 1)


from math import *
n = int(input())
a = [i for i in map(int, input().split())]
b = [1] * n
for i in range(n):
	if a[i] > i:
		b[i] = ceil((a[i] - i) / n) // 1 + 1
(index, value) = (-1, 1000000000)
for i in range(n):
	if b[i] < value:
		value = b[i]
		index = i + 1
print(index)


import functools
maxn = 4557430888798830399

def cmp1(a, b):
	if a[0] == b[0]:
		return a[1] - b[1]
	else:
		return a[0] - b[0]
n = int(input())
q = list(map(int, input().split()))
minn = maxn
ans = 0
for i in range(n):
	x = q[i] - i + n - 1
	if minn > x // n:
		minn = x // n
		ans = i
print(ans + 1)


from math import ceil

def main():
	n = int(input())
	a = [int(c) for c in input().split()]
	num_turns = [0] * n
	for (k, elm) in enumerate(a):
		num_turns[k] = ceil((elm - k) / n)
	mn = min(num_turns)
	for (k, e) in enumerate(num_turns, 1):
		if e == mn:
			print(k)
			return
main()


def f(i, ai, n):
	c = ai // n * n + i
	if c < ai:
		c += n
	return c
n = int(input())
a = list(map(int, input().split()))
b = [f(i, a[i], n) for i in range(n)]
print(b.index(min(b)) + 1)


n = int(input())
exits = list(map(int, input().split()))
i1 = len(exits)
earliest_index = None
earliest_val = None
for (i, val) in enumerate(exits):
	exits_ = val // i1
	left = val % i1
	if left > i:
		exits_ += 1
	if earliest_val is None or earliest_val > exits_:
		earliest_val = exits_
		earliest_index = i
print(earliest_index + 1)


import math
n = int(input())
l = list(map(int, input().split()))
(mi, res) = (-1, 1)
for i in range(n):
	r = max(math.ceil((l[i] - i + n) / n), 1)
	if mi == -1:
		mi = r
	elif mi > r:
		mi = r
		res = i + 1
print(res)


import math
n = int(input())
a = list(map(int, input().split()))
x = 10 ** 9 + 2
y = 0
for i in range(n):
	if x > math.ceil((a[i] - i) / n) * n + i + 1:
		x = math.ceil((a[i] - i) / n) * n + i + 1
		y = i + 1
print(y)


n = int(input())
a = list(map(int, input().split()))
na = []
ma = min(a)
ma -= ma % n
for i in a:
	na.append(i - ma)
a = na
c = 1
while True:
	for (e, i) in enumerate(a):
		if i < c:
			print(e + 1)
			exit()
		c += 1


def main():
	n = int(input())
	a = list(map(int, input().split()))
	a = [(i + 1, a[i] - i) for i in range(n)]
	a.sort(key=lambda b: (b[1] - 1) // n)
	a = list([b for b in a if (b[1] - 1) // n == (a[0][1] - 1) // n])
	a.sort(key=lambda b: b[0])
	print(a[0][0])
	return 0
main()


n = int(input())
arr = [0]
arr += list(map(int, input().split()))
maxv = 1e+18
res = 0
for i in range(1, n + 1):
	if maxv > (arr[i] - i) // n + 1:
		maxv = (arr[i] - i) // n + 1
		res = i
print(res)


n = int(input())
Ar = [int(x) for x in input().split()]
ar = []
for i in range(n):
	t = (Ar[i] - i) / n
	if t < 0:
		t = 0
	if t != int(t):
		t = int(t) + 1
	ar.append(t)
a = []
for i in range(n):
	m = i + n * ar[i]
	a.append(m)
print(a.index(min(a)) + 1)


n = int(input())
nums = input()
nums = [int(i) for i in nums.split()]
smallest = [-1 for _ in range(len(nums))]
for i in range(len(nums)):
	minim = nums[i]
	offset = i
	loop = len(nums)
	k = minim // loop
	cand = loop * k + offset
	if cand < minim:
		cand += loop
	smallest[i] = cand
ans = 0
for i in range(len(nums)):
	if smallest[ans] > smallest[i]:
		ans = i
print(ans + 1)


(n, l) = (int(input()), [int(s) - i for (i, s) in enumerate(input().split())])
x = (l[min(range(n), key=l.__getitem__)] + n - 1) // n * n
for (i, a) in enumerate(l, 1):
	if a <= x:
		print(i)
		break


def solu(num_ent, q):
	m = min(q)
	t = int(m / num_ent)
	for i in range(0, num_ent):
		q[i] -= t * num_ent
	while True:
		for i in range(0, num_ent):
			q[i] -= i
			if q[i] <= 0:
				return i + 1
		for i in range(0, num_ent):
			q[i] -= num_ent - i
num_ent = int(input())
q = list(map(int, input().split()))
print(solu(num_ent, q))


import bisect
from itertools import accumulate
import os
import sys
import math
from decimal import *
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def SieveOfEratosthenes(n):
	prime = []
	primes = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if primes[p] == True:
			prime.append(p)
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1
	return prime

def primefactors(n):
	fac = []
	while n % 2 == 0:
		fac.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 2):
		while n % i == 0:
			fac.append(i)
			n = n // i
	if n > 1:
		fac.append(n)
	return fac

def factors(n):
	fac = set()
	fac.add(1)
	fac.add(n)
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			fac.add(i)
			fac.add(n // i)
	return list(fac)
(n, a, m, res) = (int(input()), [*map(int, input().split())], 10000000000.0, -1)
k = [math.ceil((ai - i) / n) for (i, ai) in enumerate(a)]
print(k.index(min(k)) + 1)


n = int(input())
a = list(map(int, input().split()))
z = 0
for i in range(len(a)):
	z += 1
	a[i] -= z
	if a[i] < 0:
		print(i + 1)
		quit()
for i in range(len(a)):
	a[i] //= z
	if a[i] == 0:
		print(i + 1)
		quit()
indx = -1
mini = 100000000000000000
for i in range(len(a)):
	if a[i] < mini:
		mini = a[i]
		indx = i + 1
print(indx)


from math import ceil
n = int(input())
arr = list(map(int, input().split()))
dp = []
if n == 1:
	print(1)
	exit()
if arr[0] == 0:
	print(1)
	exit()
for i in range(n):
	if arr[i] - i <= 0:
		dp.append(0)
	else:
		k1 = arr[i] - i
		k = ceil(k1 / n)
		dp.append(k)
cnt = 10 ** 18
for i in range(n):
	if dp[i] < cnt:
		cnt = dp[i]
		ans = i
print(ans + 1)


n = int(input())
a = list(map(int, input().split()))
m = min(a)
if m > n:
	s = n * (m // n)
	a = [ai - s for ai in a]
while True:
	ax = [ai - i for (i, ai) in enumerate(a)]
	d = [i for (i, ai) in enumerate(ax, 1) if ai <= 0]
	if len(d) > 0:
		print(d[0])
		exit(0)
	a = [ai - n for ai in a]


_ = input()
arr = list(map(int, input().split()))
best = None
for i in range(len(arr)):
	pos_at_zero = arr[i] % len(arr)
	if pos_at_zero > i:
		extra = len(arr) - pos_at_zero + i
	else:
		extra = i - pos_at_zero
	time_needed = arr[i] + extra
	if best is None or best[0] > time_needed:
		best = (time_needed, i)
print(best[1] + 1)


def f(n, l):
	cur_entry = 0
	cur_rounds = l[0] // n + int(l[0] % n > 0)
	for i in range(1, n):
		a = l[i] - i
		rounds = a // n + int(a % n > 0)
		if rounds < cur_rounds:
			cur_entry = i
			cur_rounds = rounds
	return cur_entry + 1
in_n = int(input())
in_l = [int(a) for a in input().split()]
print(f(in_n, in_l))


n = int(input())
l = list(map(int, input().split()))
k = 0
min = 500000000
l.insert(0, '')
for i in range(1, n + 1):
	p = l[i] // n
	if p < min:
		min = p
while True:
	for j in range(1, n + 1):
		if l[j] < j:
			print(j)
			k = 1
			break
		elif l[j] > n:
			p = l[j] // n
			if p == min:
				l[j] = l[j] % n
		else:
			l[j] = 0
	if k == 1:
		break


n = int(input().strip())
ais = list(map(int, input().strip().split()))

def ceil(a, b):
	return -(-a // b)
bis = [ceil(ai - i, n) for (i, ai) in enumerate(ais)]
bmin = min(bis)
ibmin = bis.index(bmin)
print(ibmin + 1)


n = int(input())
q = list(map(int, input().split()))
ans = [[max(0, (q[i] + n - 1 - i) // n), i] for i in range(len(q))]
print(min(ans)[1] + 1)


N = int(input())
a = list(map(int, input().split()))
mi = min(a)
rec = [0] * N
for i in range(N):
	(l, r) = (0, 10 ** 9 + 1)
	while r - l >= 1:
		mid = (l + r) // 2
		if a[i] > mid * N + i:
			l = mid + 1
		else:
			r = mid
	rec[i] = l
mi = float('inf')
ind = 0
for i in range(N):
	if rec[i] < mi:
		mi = rec[i]
		ind = i
print(ind + 1)


n = int(input())
i = 0
ans = 1000000000000000000
for x in map(int, input().split()):
	if i >= x:
		ans = i + 1
		break
	tmp = (x - i) // n + 1 if (x - i) % n else (x - i) // n
	t = tmp * n + i + 1
	ans = ans if ans < t else t
	i += 1
ans %= n
if ans == 0:
	ans = n
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
t = min(a)
while a[t % n] > t:
	t += 1
print(t % n + 1)


n = int(input())
a = []
b = []
a = [int(x) for x in input().split()]
for i in range(0, n):
	x = a[i]
	if x >= i:
		x -= i
	else:
		x = 0
	y = x / n
	y = int(y)
	x %= n
	if x == 0:
		b.append(y + 1)
	else:
		b.append(y + 2)
mini = 10000000000000000000
for i in range(0, n):
	if mini > b[i]:
		mini = b[i]
		ind = i + 1
print(ind)


def go():
	n = int(input())
	qs = [int(x) for x in input().split()]

	def h(a, b):
		return 1 if a > b else 0
	minim = min(qs)
	starting = minim % n
	minimal = float('inf')
	minimal_arg = starting
	for u in range(n):
		i = (u + starting) % n
		if qs[i] - minim - u <= 0:
			xxx = u % n + 1
			return i + 1
print(go())


n = int(input())
a = [int(i) for i in input().split(' ')]
t = [0] * n
for i in range(n):
	if a[i] <= i:
		continue
	a[i] -= i
	t[i] = a[i] // n
	if t[i] * n < a[i]:
		t[i] += 1
mn = 10 ** 9 + 1
pos = 0
for i in range(n):
	if t[i] < mn:
		mn = t[i]
		pos = i + 1
print(pos)


n = int(input())
v = [int(x) for x in input().split(' ')]
minv = min(v)
minindex = v.index(minv)
i = minv % n
counter = 0
while True:
	if i >= n:
		i = i % n
	if v[i] - counter - minv <= 0:
		print(i + 1)
		break
	counter = counter + 1
	i = i + 1


import math

def median(a: []):
	a.sort()
	if len(a) % 2 == 1:
		return a[len(a) // 2]
	return (a[len(a) // 2] + a[len(a) // 2 - 1]) / 2

def mode(a: []):
	g = {}
	m = -1
	for i in a:
		g[i] = g.get(i, 0) + 1
		m = max(m, g[i])
	ans = int(10000000.0)
	for i in g:
		if g[i] == m and ans > i:
			ans = i
	return ans

def avg(x: [], w: []):
	return round(sum([x[i] * w[i] for i in range(len(x))]) / sum(w), 1)

def avg(x: []):
	return sum(x) / len(x)

def quartiles(a: []):
	a.sort()
	m = len(a) // 2
	l = a[:m]
	if len(a) % 2 == 1:
		m += 1
	r = a[m:]
	return (median(l), median(a), median(r))

def std(a: []):
	u = avg(a)
	return math.sqrt(sum([(a[i] - u) ** 2 for i in range(len(a))]) / len(a))

def main():
	n = int(input())
	a = list(map(int, input().split()))
	min_x = int(1e+16)
	ans = -1
	for i in range(n):
		x = math.ceil((a[i] - i) / n)
		if x < min_x:
			min_x = x
			ans = i + 1
	print(ans)
main()


n = int(input())
a = list(map(int, input().split()))
x = min(a)
d = x // n
for i in range(n):
	a[i] = a[i] - d * n
i = 0
z = 0
while a[i] > z:
	z += 1
	i = (i + 1) % n
print(i + 1)


def func(As, n, entranceNum=0):
	Min = min(As)
	p = entranceNum
	while True:
		if As[p] == 0:
			return p + 1
		if p != n - 1:
			for i in range(p + 1, n):
				d = i - p
				if As[i] <= d:
					return i + 1
		for i in range(p):
			d = n - p + i
			if As[i] <= d:
				return i + 1
		As = [As[i] - Min for i in range(n)]
		p = (Min % n + p) % n
		Min = min(As)
num = int(input())
A = list(map(int, input().split(' ')))
print(func(A, num))


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
sys.setrecursionlimit(10000)

def read_int():
	return int(input())

def read_int_n():
	return list(map(int, input().split()))

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

@mt
def slv(N, E):
	mint = sys.maxsize
	mini = -1
	for (i, e) in enumerate(E):
		t = e
		if (t - i) % N == 0:
			pass
		else:
			t = e // N * N + i
			t = t if t >= e else t + N
		if t < mint:
			mint = t
			mini = i
	return mini + 1

def main():
	N = read_int()
	E = read_int_n()
	print(slv(N, E))
main()


n = int(input())
a = list(map(int, input().split()))
m = 10 ** 9 + 1
for i in a:
	if i // n < m:
		m = i // n
for i in range(n):
	a[i] -= n * m
	if a[i] <= i:
		print(i + 1)
		exit()
for i in range(n):
	if a[i] - n <= i:
		print(i + 1)
		break


n = int(input())
m = list(map(int, input().split(' ')))
rounds = max(m)
for i in m:
	rounds = min(int(i / n), rounds)
for i in range(len(m)):
	m[i] -= rounds * n
output = 0
for i in range(len(m)):
	if m[i] <= i:
		print(i + 1)
		output = 1
		break
if output == 0:
	for i in range(len(m)):
		if m[i] <= n:
			print(i + 1)
			output = 1
			break


from math import ceil
n = int(input())
data = list(map(int, input().split()))
min_ = ceil(data[0] / n)
cnt = 0
pos = 1
for el in data:
	if el - cnt <= 0:
		print(cnt + 1)
		exit()
	if ceil((el - cnt) / n) < min_:
		min_ = ceil((el - cnt) / n)
		pos = cnt + 1
	cnt += 1
print(pos)


n = int(input())
a = [int(i) for i in input().split()]
v = min(a)
c = v % n
m = 0
for i in range(n):
	a[i] -= v
while True:
	if a[c] - m <= 0:
		print(c + 1)
		exit()
	if c == n - 1:
		c = 0
	else:
		c += 1
	m += 1


import math
R = lambda : map(int, input().split())
n = int(input())
a = R()
(bi, bs) = (math.inf, math.inf)
for (i, ai) in enumerate(a):
	k = (ai - i) // n + (0 if (ai - i) % n == 0 else 1)
	if i + k * n < bs:
		(bi, bs) = (i, i + k * n)
print(bi + 1)


import math
n = int(input())
a = [int(x) for x in input().split()]
res = [0] * n
for i in range(n):
	res[i] = math.ceil((a[i] - i) / n)
answer = 0
min = res[0]
for k in range(1, n):
	if res[k] < min:
		answer = k
		min = res[k]
print(answer + 1)


n = int(input())
lengths = list(map(int, input().split(' ')))
lengths = [m - i for (i, m) in enumerate(lengths)]
m = min(lengths)
if m % n == 0:
	a = m
else:
	a = m - m % n + n
lengths = [i - a for i in lengths]
for (i, x) in enumerate(lengths):
	if x <= 0:
		print(i + 1)
		break


n = int(input())
arr = list(map(int, input().split()))
for i in range(n):
	arr[i] = (arr[i] - i) // n + (1 if (arr[i] - i) % n > 0 else 0)
print(arr.index(min(arr)) + 1)


n = input()
n = int(n)

def getIntList():
	return list(map(int, input().split()))
za = getIntList()
base = min(za)
now = base % n
acc = base
while za[now] > acc:
	now = (now + 1) % n
	acc += 1
print(now + 1)


import math
n = int(input().strip())
a = [int(x) for x in input().strip().split(' ')]
minm = 1000000000000000000
ans = 0
for i in range(n):
	v = a[i] - i
	if max(0, v) == 0:
		if 0 < minm:
			ans = i + 1
			minm = 0
	else:
		b = round(math.ceil(v / n) + 1)
		if b < minm:
			ans = i + 1
			minm = b
print(ans)


def hi():
	return 'hi'
n = int(input())
a = list(map(int, input().split()))
mi = min(map(lambda x: x // n * n, a))
a = list(map(lambda x: x - mi, a))
r = 0
rr = 0
while a[r] > rr:
	r += 1
	rr += 1
	if r == n:
		r = 0
print(r + 1)


n = int(input())
a = list(map(int, input().split()))
flo = lambda a, b: (a + b - 1) // b
print(1 + min((n * flo(a[i] - i, n) + i for i in range(n))) % n)


R = lambda : map(int, input().split())
n = int(input())
arr = list(R())
m = min(arr)
mi = arr.index(m)
left = 0
right = 10 ** 9

def checkFind(t):
	i = 0
	find = False
	while i < n:
		if n * t + i + 1 > arr[i]:
			find = True
			break
		i += 1
	return find
t = 10 ** 9
while left <= right:
	m = (left + right) // 2
	if checkFind(m):
		t = min(t, m)
		right = m - 1
	else:
		left = m + 1
i = 0
while i < n:
	if n * t + i + 1 > arr[i]:
		break
	i += 1
print(i + 1)


import math
n = int(input())
a = list(map(int, input().split()))
(first_gateway, earliest_exit) = (None, math.inf)
for (i, ai) in enumerate(a):
	loops = math.ceil((ai - i) / len(a))
	minutes = i + loops * len(a)
	if minutes < earliest_exit:
		earliest_exit = minutes
		first_gateway = i + 1
print(first_gateway)


N = int(input())
q = list(map(int, input().split()))
s = []
for (i, v) in enumerate(q):
	if q[i] < i + 1:
		r = 0
	else:
		r = (q[i] - i - 1) // N + 1
	s.append(r)
print(s.index(min(s)) + 1)


n = int(input())
a = [*map(int, input().split())]
t = min(a)
while a[t % n] > t:
	t += 1
print(t % n + 1)


import math
n = int(input())
line_str = str(input())
lines = [int(s) for s in line_str.split() if s.isdigit()]
bk = 9999999999999999
res = lines.index(min(lines))
k = 0
for i in range(0, len(lines)):
	t1 = (lines[i] - i) // n
	for t in range(t1, t1 + 10):
		if i + t * n >= lines[i] and i + t * n < bk:
			bk = i + t * n
			res = i
print(res + 1)


import math
n = int(input())
li = [*map(int, input().split())]
for i in range(n):
	li[i] = math.ceil(max(0, (li[i] - i) / n))
print(li.index(min(li)) + 1)


import math
n = int(input())
arr = list(map(int, input().split()))
b = []
for i in range(n):
	b.append(math.ceil((arr[i] - i) / n))
m = pow(2, 31)
index = -1
for i in range(n):
	if b[i] < m:
		m = b[i]
		index = i + 1
print(index)


3

def solve(N, A):
	mn = min(A)
	if mn > N:
		A = [a - mn // N * N for a in A]
	decr = 0
	i = 0
	while True:
		if A[i] - decr <= 0:
			return i + 1
		decr += 1
		i += 1
		if i == N:
			i = 0

def main():
	N = int(input())
	A = [int(e) for e in input().split(' ')]
	assert len(A) == N
	print(solve(N, A))

def __starting_point():
	main()
__starting_point()


n = int(input())
a = list(map(int, input().split()))
s = min(a)
for q in range(n):
	a[q] -= s // n * n
q1 = 0
while a[q1 % n] - q1 > 0:
	q1 += 1
print(q1 % n + 1)


from math import ceil
n = int(input())
s = list(map(int, input().split()))
for i in range(0, n):
	s[i] = (s[i] - i) / n
ml = []
for i in s:
	ml += [int(ceil(i))]
ans = 1000000000
for i in ml:
	ans = min(ans, i)
for i in range(n):
	if ml[i] == ans:
		print(i + 1)
		exit()


from math import ceil as cl
n = int(input())
s = list(map(int, input().split()))
l = []
for i in range(n):
	n1 = s[i]
	x = cl((n1 - i) / n)
	l.append(x)
mn = 10 ** 23
for i in range(n):
	if l[i] < mn:
		mn = l[i]
		ans = i + 1
print(ans)


import math

def main():
	n = int(input())
	people = list(map(int, input().split()))
	min_k = float('inf')
	values = {}
	for i in range(n):
		k = math.ceil((people[i] - i) / n)
		if k not in values.keys():
			values[k] = [i]
		else:
			values[k].append(i)
		min_k = min(min_k, k)
	print(values[min_k][0] + 1)
main()


import math
R = lambda : list(map(int, input().split()))
(n, a, m, res) = (int(input()), R(), 10000000000.0, -1)
k = ((i, math.ceil((ai - i) / n)) for (i, ai) in enumerate(a))
for _ in range(n):
	t = next(k)
	if t[1] < m:
		m = t[1]
		res = t[0]
print(res + 1)


n = int(input())
nums = list(map(int, input().strip().split()))
mmin = float('inf')
res = 1
for i in range(n):
	cur = nums[i] - i
	if cur <= 0:
		res = i + 1
		break
	cur = 1 + (cur - 1) // n
	if cur < mmin:
		mmin = cur
		res = i + 1
print(res)


n = int(input())
queues = list(map(int, input().strip().split()))
shortest = min(queues) // n * n
queues = list(map(lambda x: x - shortest, queues))
for i in range(1, n + 1):
	if queues[i - 1] - i < 0:
		print(i)
		break
else:
	for i in range(1, n + 1):
		if queues[i - 1] - i - n < 0:
			print(i)
			break


from math import ceil
for u in range(1):
	n = int(input())
	x = [int(w) for w in input().split()]
	ans = []
	for i in range(n):
		if i + 1 >= x[i] + 1:
			ans.append(i + 1)
		else:
			t = ceil((x[i] + 1 - (i + 1)) / n)
			ans.append(i + 1 + t * n)
	a = min(ans)
	print(ans.index(a) + 1)


n_entrances = int(input())
queued = input()
queued = [int(i) for i in queued.split(' ')]
entrance_found = 0
current_entrance = 0
minim = min(queued)
if minim > 0:
	queued = [i - minim for i in queued]
	current_entrance = minim % n_entrances
counter = 1
current_entrance_queue_len = queued[current_entrance]
while entrance_found == 0:
	if current_entrance_queue_len > 0:
		current_entrance += 1
		current_entrance = current_entrance % n_entrances
		current_entrance_queue_len = queued[current_entrance] - counter
		counter += 1
	else:
		entrance_found = current_entrance + 1
		break
print(entrance_found)


import math
n = int(input())
arr = list(map(int, input().split()))
ct = 9999999999
ans = -1
for i in range(n):
	arr[i] -= i
	if arr[i] <= 0:
		if ct != 0:
			ct = 0
			ans = i + 1
	elif math.ceil(arr[i] / n) < ct:
		ct = math.ceil(arr[i] / n)
		ans = i + 1
print(ans)


n = int(input().strip())
a = list(map(int, input().strip().split()))
am = min(a)
i = am % n
st = i
ln = 0
while 1:
	a[i] = a[i] - am - i + st - n * ln
	if a[i] <= 0:
		break
	i += 1
	if i == n:
		i = 0
		ln += 1
	if i == st:
		am = 0
		st = 0
		ln = 0
print(i + 1)


n = int(input())
a = list(map(int, input().split()))
ans = 0
flg = False
c = 0
mn = 10 ** 10
for (i, j) in enumerate(a):
	if j - i <= 0:
		print(i + 1)
		exit()
	else:
		x = (j - (i + 1)) // n + 2
		if x < mn:
			mn = x
			ans = i + 1
print(ans)


n = int(input())
a = list(map(int, input().split()))
for i in range(1, n + 1):
	a[i - 1] = (a[i - 1] - i + n) // n
print(a.index(min(a)) + 1)


from math import ceil
n = int(input())
a = list(map(int, input().split()))
t = [i + n * ceil((a[i] - i) / n) for i in range(n)]
print(t.index(min(t)) + 1)


n = int(input())
a = [int(v) for v in input().split()]
a = [ai - i for (i, ai) in enumerate(a)]
minv = 100000000000000
mini = None
for (i, ai) in enumerate(a):
	if ai <= 0:
		print(i + 1)
		exit()
	else:
		v = (ai - 1) // n
		if v < minv:
			minv = v
			mini = i
print(mini + 1)


n = int(input())
arr = list(map(int, input().split()))
m = 1000000000000
for i in range(n):
	cur = arr[i] % n
	val = arr[i]
	if i < cur:
		val += n - cur + i
	else:
		val += i - cur
	if val < m:
		m = val
		ans = i + 1
print(ans)


n = int(input())
mass = list(map(int, input().split()))
tmin = max(mass) * 2
j = 0
for i in range(0, n):
	l = i - mass[i] % n
	if l < 0:
		l += n
	t = mass[i] + l
	if t < tmin:
		tmin = t
		j = i
print(j + 1)


n = int(input())
l = [int(x) for x in input().split()]
cur_idx = 0
cur_val = max(0, (l[0] - 1) // n + 1)
for i in range(n):
	val = max(0, (l[i] - i - 1) // n + 1)
	if val < cur_val:
		cur_val = val
		cur_idx = i
print(cur_idx + 1)


import math
n = int(input())
a = list(map(int, input().split(' ')))
for i in range(0, n):
	a[i] = math.ceil((a[i] - i) / float(n))
	if a[i] < 0:
		a[i] = 0
temp = min(a)
minimum = 100000000000000000000
gate = 0
for i in range(0, n):
	if a[i] < minimum:
		minimum = a[i]
		gate = i
print(gate + 1)


n = int(input())
a = list(map(int, input().split()))
m = a[0]
for i in range(n):
	m = min(m, a[i])
if m == 0:
	ans = 1
	for i in range(n):
		if a[i] - i <= 0:
			ans = i + 1
			break
	print(ans)
else:
	cur = m % n
	for i in range(cur, cur + n):
		d = i - cur
		i %= n
		if a[i] - d - m <= 0:
			ans = i + 1
			break
	print(ans)


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from functools import cmp_to_key
from heapq import *
from math import gcd, factorial, floor, ceil, sqrt
from copy import deepcopy
from collections import deque
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	y %= p - 1
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
inf = pow(10, 20)
mod = 10 ** 9 + 7

def chck(mid, a, n):
	ind = mid % n
	if a[ind] >= mid:
		return True

def solve(case):
	n = int(inp())
	a = lis()
	ans = inf
	for i in range(n):
		lo = 0
		hi = a[i]
		temp = hi
		while lo <= hi:
			mid = (lo + hi) // 2
			if n * mid + i >= a[i]:
				temp = min(temp, mid)
				hi = mid - 1
			else:
				lo = mid + 1
		ans = min(ans, temp * n + i)
	print(ans % n + 1)
testcase(1)


import math
n = int(input())
l = list(map(int, input().split()))
(c, f, p, k) = (0, 0, 0, 0)
l2 = []
for i in range(len(l)):
	if l[i] >= 1:
		l[i] -= i
		p = math.ceil(l[i] / n)
		l2.append(p)
		if p == 0:
			print(i + 1)
			f = 1
			break
	else:
		print(i + 1)
		f = 1
		break
min = 1000000001
s = 0
if f != 1:
	for i in range(len(l2)):
		if l2[i] < min:
			min = l2[i]
			s = i
	print(s + 1)


from math import ceil
n = int(input())
s = list(map(int, input().split()))
l = []
for i in range(n):
	s[i] = s[i] - i
	l += [ceil(s[i] / n)]
ind = 1
m = l[0]
for i in range(n):
	if m > l[i]:
		ind = i + 1
		m = l[i]
print(ind)


n = int(input())
a = [int(x) for x in input().split()]
enter = [0] * n
for i in range(n):
	time = a[i]
	pos = time % n
	if i >= pos:
		time += i - pos
	else:
		time += i + n - pos
	enter[i] = time
print(min(enumerate(enter), key=lambda x: x[1])[0] + 1)


n = int(input())
u = list(map(int, input().split()))
inf = 10 ** 10
ans = [inf] * n
m = inf
mi = 0
for i in range(n):
	if (u[i] - i) % n == 0:
		ans[i] = (u[i] - i) // n
	elif u[i] - i <= 0:
		ans[i] = 0
	else:
		ans[i] = (u[i] - i) // n + 1
	if ans[i] < m:
		m = ans[i]
		mi = i
print(mi + 1)


import math
n = int(input())
l = list(map(int, input().strip().split()))
l1 = []
for (x, y) in enumerate(l):
	if y < x:
		m = 0
	else:
		m = y - x
	l1.append(math.ceil(m / n))
min1 = 100000000000000
min2 = 1000000000000
for i in range(n):
	if l1[i] < min1:
		min1 = l1[i]
		min2 = i + 1
print(min2)


n = int(input())
lst = [int(x) for x in input().split()]
m = min(lst)
while not lst[m % n] - m <= 0:
	m += 1
print(m % n + 1)


i = int(input().strip())
q = list(map(int, input().strip().split()))
if q[0] % i == 0:
	m = int(q[0] / i)
else:
	m = int(q[0] / i) + 1
for j in range(i):
	if q[j] - j > 0:
		a = (q[j] - j) % i
		if a == 0:
			q[j] = int((q[j] - j) / i)
			if m > q[j]:
				m = q[j]
		else:
			q[j] = int((q[j] - j) / i) + 1
			if m > q[j]:
				m = q[j]
	else:
		q[j] = 0
		m = 0
		break
for j in range(i):
	if q[j] == m:
		print(j + 1)
		break


def calc(a):
	m = min(a)
	l = len(a)
	e = 0
	for i in range(l):
		a[i] -= m
	e = (e + m) % l
	move = 0
	while a[e] - move > 0:
		e = (e + 1) % l
		move += 1
	return e

def get_ints():
	return [int(n) for n in input().split()]

def get_floats():
	return [float(n) for n in input().split()]
a = get_ints()
assert len(a) == 1
n = a[0]
a = get_ints()
assert len(a) == n
entry = 1 + calc(a)
print(entry)


import math

def f(n, nums):
	res = []
	for (i, j) in enumerate(nums):
		t = (j - i) / n
		res.append((math.ceil(t), i + 1))
	return min(res)[1]
n = int(input())
queues = [int(i) for i in input().split()]
print(f(n, queues))


import math
n = int(input())
a = list(map(int, input().split()))
k = [0] * n
for i in range(n):
	if a[i] > i:
		k[i] = math.ceil((a[i] - i) / n)
	else:
		print(i + 1)
		quit()
m = min(k)
for i in range(n):
	if k[i] == m:
		print(i + 1)
		quit()


import math
n = int(input())
l = list(map(int, input().split()))
mini = -1
ministep = -1
for i in range(n):
	if l[i] - i > 0:
		step = math.ceil((l[i] - i) / n)
		if i == 0:
			mini = i
			ministep = step
		elif ministep > step:
			mini = i
			ministep = step
	else:
		mini = i
		break
print(mini + 1)


while 1:
	try:
		n = int(input())
		a = [int(item) for item in input().split()]
		for i in range(n):
			tour = a[i] // n
			if i < a[i] % n:
				tour += 1
			a[i] = tour
		min_tour = float('inf')
		for i in range(n):
			if a[i] < min_tour:
				answer = i
				min_tour = a[i]
		print(answer + 1)
	except EOFError:
		break


n = int(input())
ls = list(map(int, input().split()))
res = []
for i in range(n):
	if ls[i] == 0:
		res.append(i + 1)
		continue
	x = ls[i] % n
	if x > i:
		res.append((ls[i] // n + 1) * n + i + 1)
	else:
		res.append(ls[i] // n * n + i + 1)
Min = res[0]
num = 1
for i in range(n):
	if res[i] < Min:
		Min = res[i]
		num = i + 1
print(num)


n = int(input())
s = input()
s = s.split()
a = []
f = 0
for i in s:
	a.append(int(i))
for i in range(n):
	if a[i] <= i:
		print(i + 1)
		f = 1
		break
if f == 0:
	aa = []
	for i in range(n):
		temp = []
		if n >= a[i]:
			a[i] = 0
		temp.append(a[i] // n)
		temp.append(a[i] % n)
		aa.append(temp)
	minu = []
	m = 10000000000
	for i in range(n):
		if aa[i][0] < m:
			m = aa[i][0]
	for i in range(n):
		a[i] -= m * n
		if a[i] < 0:
			a[i] = 0
	for i in range(n):
		if a[i] <= i:
			print(i + 1)
			f = 1
			break
	if f == 0:
		for i in range(n):
			a[i] -= n
			if a[i] < 0:
				a[i] = 0
			if a[i] <= i:
				print(i + 1)
				f = 1
				break


n = int(input())
a = [x - i for (i, x) in enumerate(map(int, input().split()))]
m = (min(a) + n - 1) // n * n
print(next((i + 1 for i in range(n) if a[i] <= m)))


import math
n = int(input())
s = input().split()
l = [0 for i in range(n)]
for i in range(n):
	l[i] = max(math.ceil((int(s[i]) - i) / n), 0)
m = min(l)
for i in range(n):
	if l[i] == m:
		print(i + 1)
		break


n = int(input())
arr = list(map(int, input().split()))
m = int(1000000000000.0)
ans = 1
for i in range(n):
	k = arr[i] // n
	k *= n
	while k + i < arr[i]:
		k += n
	if k < m:
		m = min(m, k)
		ans = i
print(ans + 1)


import math
n = int(input())
l = list(map(lambda x: int(x), input().split()))
mint = -1
mini = -1
for i in range(n):
	t = i + 1 + n * math.ceil((l[i] - i) / n)
	if mint == -1:
		mint = t
		mini = i
	else:
		mint = min(t, mint)
		if mint == t:
			mini = i
print(mini + 1)


import math
n = int(input())
a = list(map(int, input().split()))
ans = math.inf
num = math.inf
for i in range(n):
	if num > a[i] + (i - a[i] % n) % n:
		num = a[i] + (i - a[i] % n) % n
		ans = i
print(ans + 1)


import math
n = int(input())
a = list(map(int, input().split()))
(res, ans) = (1000000000000000, 0)
for i in range(n):
	tmp = max(0, (a[i] - i + n - 1) // n) * n + (i + 1)
	if tmp < res:
		res = tmp
		ans = i + 1
print(ans)


mod = 1000000007
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
n = ii()
l = [(max(0, j - i) + n - 1) // n for (i, j) in enumerate(il())]
print(l.index(min(l)) + 1)


from math import *
n = int(input())
l = list(map(int, input().split()))
for i in range(n):
	l[i] = ceil((l[i] - i) / n)
k = min(l)
print(l.index(k) + 1)


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	a[i] = max(a[i] - i, 0)
mn = (a[0] + n - 1) // n
idx = 0
for i in range(n):
	ftw = (a[i] + n - 1) // n
	if ftw < mn:
		mn = ftw
		idx = i
print(idx + 1)


n = int(input())
ai = list(map(int, input().split()))
ans = -1
for i in range(n):
	ai[i] -= i
	if ai[i] <= 0:
		ans = i + 1
		break
if ans == -1:
	mini = 10 ** 9
	for i in range(n):
		temp = ai[i] / n
		if temp != int(temp):
			temp += 1
		if mini > int(temp):
			mini = int(temp)
			ans = i + 1
print(ans)


n = int(input())
data = [int(i) for i in input().split()]
ans = [None for i in range(n)]
for i in range(n):
	modulo = data[i] % n
	if modulo == i:
		ans[i] = data[i]
	elif i > modulo:
		ans[i] = data[i] + i - modulo
	else:
		ans[i] = data[i] + (n - modulo) + i
answer = None
min = 9999999999999999
for i in range(n):
	if ans[i] < min:
		min = ans[i]
		answer = i
print(answer + 1)


def main():
	n = int(input())
	arr = [x - idx for (idx, x) in enumerate(map(int, input().split()))]
	for (idx, x) in enumerate(arr):
		if x <= 0:
			print(idx + 1)
			exit(0)
	rounds = []
	for x in arr:
		if x % n == 0:
			rounds.append(x // n)
		else:
			rounds.append(x // n + 1)
	curr = 999999999999999
	res = 0
	for (idx, v) in enumerate(rounds):
		if v < curr:
			curr = v
			res = idx
	print(res + 1)
main()


import math
n = int(input())
lst = list(map(int, input().split()))
flst = []
for i in range(n):
	flst.append(math.ceil((lst[i] - i) / n))
	if flst[i] < 0:
		flst[i] = 0
print(flst.index(min(flst)) + 1)


n = int(input())
A = [int(x) for x in input().split()]
a = min(A)
i = a % n
for j in range(n):
	if i + j < n:
		if A[i + j] - j - a <= 0:
			print(i + j + 1)
			break
	elif A[i + j - n] - j - a <= 0:
		print(i + j + 1 - n)
		break


n = int(input())
idx___people_nr = [int(x) for x in input().split()]
temp = [max(0, idx___people_nr[i] - i) for i in range(n)]
circles_nr = (min(temp) + n - 1) // n
idx___nice_people_nr = [x - circles_nr * n for x in idx___people_nr]
for i in range(n):
	if idx___nice_people_nr[i] <= i:
		print(i + 1)
		quit()


from math import ceil
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	a[i] -= i
for i in range(n):
	a[i] = ceil(a[i] / n)
ans = -1
s = 10 ** 9 + 7
for i in range(n):
	if a[i] < s:
		s = a[i]
		ans = i + 1
print(ans)


import math
n = int(input())
a = [*map(int, input().split())]
for i in range(n):
	a[i] = max(0, math.ceil((a[i] - i) / n))
min = max(a) + 1
for i in range(n):
	if a[i] < min:
		min = a[i]
		ans = i + 1
print(ans)


n = int(input())
a = input()
a = a.split()
mini = 10 ** 10
for i in range(0, n):
	a[i] = int(a[i])
	mini = min(mini, a[i])
for i in range(0, n):
	a[i] -= mini
cur = mini % n
count = 0
while True:
	a[cur] -= count
	if a[cur] <= 0:
		break
	count += 1
	cur = (cur + 1) % n
print(cur + 1)


import sys
from math import ceil
n = int(input())
lst = list(map(int, input().split()))
ronds = {}
values = []
for (i, num) in enumerate(lst):
	if num > i:
		rond = ceil((num - i) / n)
		try:
			ronds[rond].append(i)
		except:
			ronds[rond] = [i]
			values.append(rond)
	else:
		print(i + 1)
		sys.exit()
values.sort()
print(ronds[values[0]][0] + 1)


import math
n = int(input())
arr = list(map(int, input().split()))
min1 = math.ceil(arr[0] / n)
pos = 0
for i in range(1, n):
	temp = math.ceil((arr[i] - i) / n)
	if temp < min1 and temp >= 0:
		min1 = temp
		pos = i
print(pos + 1)


n = int(input())
a = list(map(int, input().split()))
mn = float('+inf')
for i in range(n):
	time = n * (a[i] // n) + (n if i < a[i] % n else 0) + i
	if time < mn:
		ent = i + 1
		mn = time
print(ent)


n = int(input())
s = input().split(' ')
for i in range(n):
	s[i] = int(s[i])
round = 1000000000
for i in range(n):
	if round > s[i] // n:
		round = s[i] // n
for i in range(n):
	s[i] -= round * n
i = 0
time = 0
while 1:
	if s[i] <= time:
		break
	i = (i + 1) % n
	time += 1
print(i + 1)


import configparser
import sys
input = sys.stdin.readline

def ceil_div(x, y):
	return -(-x // y)

def main():
	n = int(input())
	a = [int(x) for x in input().split(' ')]
	best = [10000000000.0, 1]
	for i in range(0, n):
		cur = a[i] - i
		if cur <= 0:
			print(i + 1)
			return
		else:
			times = ceil_div(cur, n)
			if times < best[0]:
				best[0] = times
				best[1] = i + 1
	print(best[1])
main()


n = int(input())
arr = list(map(int, input().split()))
mn = min(arr)
mn = mn // n
if mn != 0:
	for i in range(n):
		arr[i] = arr[i] - mn * n
ent = 1
tot = 0
while True:
	arr[ent - 1] = arr[ent - 1] - tot
	if arr[ent - 1] <= 0:
		print(ent)
		exit()
	tot += 1
	ent += 1
	if ent == n + 1:
		ent = 1


a = int(input())
z = list(map(int, input().split()))
ans = []
k = len(z)
for i in range(len(z)):
	if (z[i] - i) % len(z) == 0:
		ans.append((z[i] - i) // k)
	else:
		ans.append((z[i] - i) // k)
		ans[-1] += 1
t = min(ans)
print(ans.index(t) + 1)


n = int(input())
A = list(map(int, input().split()))
ans = 0
ans_kr = 1000000000000
for i in range(n):
	k = A[i] // n
	if A[i] % n - i > 0:
		k += 1
	if k < ans_kr:
		ans = i
		ans_kr = k
print(ans + 1)


n = int(input())
a = list(map(int, input().split()))
m = min(a) // n * n
for i in range(n):
	a[i] -= m
for i in range(2 * n):
	if a[i % n] - i <= 0:
		print(i % n + 1)
		exit()


n = int(input())
enters = [int(i) for i in input().split()]
minimum = min(enters)
le = len(enters)
if minimum > 0:
	for i in range(le):
		enters[i] -= minimum
f = True
curPos = minimum % n
if enters[curPos] == 0:
	print(curPos + 1)
	f = False
curPos += 1
curPos %= n
allDel = 0
while f:
	enters[curPos] -= 1 + allDel
	if enters[curPos] <= 0:
		print(curPos + 1)
		break
	curPos += 1
	curPos %= n
	allDel += 1


try:
	while True:
		n = int(input())
		arr = list(map(int, input().split()))
		for (i, v) in enumerate(arr):
			arr[i] = (arr[i] + len(arr) - i - 1) // len(arr)
		vmin = min(arr)
		for (idx, v) in enumerate(arr):
			if v == vmin:
				print(idx + 1)
				break
except Exception as e:
	pass


n = int(input())
arr = [int(i) for i in input().split()]
mi = 10 ** 9 + 1
saved = 0
for j in range(n):
	if (arr[j] - j + n - 1) // n * n < mi:
		mi = (arr[j] - j + n - 1) // n * n
		saved = j + 1
print(saved)


n = int(input())
a = list(map(int, input().split()))
b = []
mi = 10000000000.0
for i in range(n):
	b.append([a[i] // n, a[i] % n])
	mi = min(mi, a[i] // n)
r = 0
for i in range(n):
	if b[i][0] == mi and b[i][1] < i + 1:
		ii = i + 1
		r = 1
		break
if r == 0:
	for i in range(n):
		if b[i][0] == mi or (b[i][0] == mi + 1 and b[i][1] < i + 1):
			ii = i + 1
			break
print(ii)


n = int(input())
a = [int(num) for num in input().split()]
min = a[0] // n + 1
if a[0] % n != 0:
	min = min + 1
gate = 1
for i in range(0, n):
	x = (a[i] - i) // n + 1
	if (a[i] - i) % n != 0:
		x = x + 1
	if x < min:
		gate = i + 1
		min = x
	if a[i] - i < 1:
		gate = i + 1
		break
print(gate)


n = int(input())
a = [int(x) for x in input().split()]
ind = min(a)
for i in range(n):
	if a[ind % n] > ind:
		ind += 1
print(ind % n + 1)


import math
(n, mp) = (int(input()), [*map(int, input().split())])
k = [math.ceil((ai - i) / n) for (i, ai) in enumerate(mp)]
print(k.index(min(k)) + 1)


n = int(input())
a = [int(x) for x in input().split()]
mini = 1000000000
for x in a:
	if x // n < mini:
		mini = x // n
result = -1
for i in range(n):
	a[i] -= mini * n
	if a[i] <= i:
		result = i
		break
if result == -1:
	for i in range(n):
		if a[i] - n <= i:
			result = i
			break
print(result + 1)


def worldcup():
	n = int(input())
	queues = list(map(int, input().split(' ')))
	m = min(queues)
	t = m % n
	i = 0
	while True:
		queues[i] -= m
		if i >= t:
			if queues[i] - (i - t) <= 0:
				return i + 1
		elif i < t:
			queues[i] = queues[i] - (n - (t + 1) + (i + 1))
		if i == n - 1:
			for i in range(t + 1):
				if queues[i] <= 0:
					return i + 1
		i += 1
print(worldcup())


n = int(input())
a = [int(i) for i in input().split()]
ans = 0
p = 10000000000
for i in range(n):
	a[i] = (a[i] - i) // n + ((a[i] - i) % n > 0)
	if a[i] == 0:
		ans = i + 1
		break
	elif p > a[i]:
		ans = i + 1
		p = a[i]
print(ans)


n = int(input())
a = [int(x) for x in input().split()]
finalIndex = 1000000000000.0
index = 0
for i in range(n):
	val = a[i]
	val -= i
	if val <= 0:
		val = 0
	sol = int(val / n)
	if val % n:
		sol += 1
	bande = i + sol * n
	if bande < finalIndex:
		finalIndex = bande
		index = i + 1
print(index)


n = int(input())
l = list(map(int, input().split()))
big = 0
al = []
for i in range(n):
	y = (l[i] - i) / n
	if int(y) < y:
		al.append(int(y) + 1)
	else:
		al.append(int(y))
	if al[-1] <= 0:
		print(i + 1)
		big = 1
		break
if big == 0:
	print(al.index(min(al)) + 1)


n = int(input())
l = list(map(int, input().split()))
j = 0
d = min(l)
position = d % n
l1 = [i - d for i in l]
while True:
	if l1[position] - j <= 0:
		break
	else:
		position += 1
		position %= n
	j += 1
print(position + 1)


import math
n = int(input())
a = list(map(int, input().split()))
if n == 1:
	print(1)
	exit()
if a[0] == 0:
	print(1)
	exit()
dp = []
for i in range(n):
	if a[i] - i <= 0:
		dp.append(0)
	else:
		dp.append(math.ceil((a[i] - i) / n))
minn = dp[0]
ans = 1
for i in range(1, n):
	if dp[i] < minn:
		minn = dp[i]
		ans = i + 1
print(ans)


n = int(input())
a = []
b = list(map(int, input().split()))
for k in range(1, n + 1):
	t = (b[k - 1] - k) // n
	a.append([k + t * n, k])
a.sort()
print(a[0][1])


n = int(input())
data = list(map(int, input().split()))
ans = 1
ans_sum = (data[0] + n - 1) // n * n
for i in range(1, n):
	k = i + (data[i] - i + n - 1) // n * n
	if k < ans_sum:
		ans = i + 1
		ans_sum = k
print(ans)


n = int(input())
a = list(map(int, input().split()))
mi = 9999999999
ans = -1
for i in range(1, n + 1):
	tmp = (a[i - 1] - i + n) // n
	if mi > tmp:
		mi = tmp
		ans = i
print(ans)


n = int(input())
import math as m
l = [int(i) for i in input().split()]
mini = 100000000000000000
for i in range(n):
	curr = (l[i] - i - 1 + n) // n
	if curr < mini:
		mini = curr
		ans = i
print(ans + 1)


from math import ceil
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	a[i] -= i
for i in range(n):
	a[i] = max(0, ceil(a[i] / n))
mn = 0
for i in range(1, n):
	if a[i] < a[mn]:
		mn = i
print(mn + 1)


n = int(input())
a = [int(x) for x in input().split()]
flag = 0
for i in range(0, n):
	if a[i] <= i:
		print(i + 1)
		flag = 100
		break
L = 1000000000000
p = 0
if flag != 100:
	for i in range(0, n):
		if (a[i] - i) % n == 0:
			k = (a[i] - i) // n
		else:
			k = (a[i] - i) // n + 1
		if k < L:
			L = k
			p = i
		elif k == L and i < p:
			p = i
	print(p + 1)


import math
n = int(input())
a = input().split()
t = 0
mi = 10 ** 9 + 1
for i in range(n):
	a[i] = int(a[i])
	t = (a[i] - i) / n
	if t < 0:
		t = 0
	t = math.ceil(t)
	if t < mi:
		mi = t
		ind = i
print(ind + 1)


d = int(input())
f = [int(i) for i in input().split()]
g = []
k = 10000000000
op = 0
for i in range(len(f)):
	f[i] = (f[i] - i + d - 1) // d
	if k > f[i]:
		k = f[i]
		op = i
print(op + 1)


n = int(input())
m = list(map(int, input().split()))
n = len(m)
dp = []
for (i, e) in enumerate(m):
	if e <= n:
		if e <= i:
			dp.append(0)
		else:
			dp.append(1)
	elif e % n <= i:
		dp.append(e // n)
	else:
		dp.append(e // n + 1)
mi = 1000000000.0
imi = n
for i in range(n):
	if dp[i] < mi:
		mi = dp[i]
		imi = i
print(imi + 1)


n = int(input())
a = list(map(int, input().split()))
ans = min(a)
while a[ans % n] - ans > 0:
	ans += 1
print(ans % n + 1)


import math
n = int(input())
A = [int(x) for x in input().split()]
B = []
for i in range(len(A)):
	B.append(math.ceil((A[i] - i) / n))
print(B.index(min(B)) + 1)


import sys
from collections import Counter

def main():
	n = int(sys.stdin.readline())
	a = list(map(int, sys.stdin.readline().split()))
	t = [0 for _ in range(n)]
	for i in range(n):
		tmp = a[i] - i
		if tmp % n:
			t[i] = tmp // n + 1
		else:
			t[i] = tmp // n
	m = float('inf')
	for i in range(n):
		if int(t[i]) < m:
			res = i + 1
			m = t[i]
	print(res)
main()


import math

def solve(arr):
	for i in range(len(arr)):
		arr[i] -= i
	mod = [math.ceil(i / len(arr)) for i in arr]
	mindex = 0
	for i in range(1, len(arr)):
		if mod[i] < mod[mindex]:
			mindex = i
	return mindex + 1
input()
a = [int(i) for i in input().strip().split(' ')]
print(solve(a))


from math import ceil

def get_input():
	return map(int, input().split())
n = int(input())
arr = get_input()
t = []
for (i, a) in enumerate(arr):
	a -= i
	if a <= 0:
		print(i + 1)
		exit()
	t.append((ceil(a / n), i, a % n))
print(min(t)[1] + 1)


t = int(input())
l = list(map(int, input().split()))
m = min(l)
n = m // t
gold = [0, t]
silver = t
for k in range(t):
	(n0, r0) = (l[k] // t, l[k] % t)
	if n0 == n:
		if r0 <= k:
			gold = [1, k]
			break
		elif k <= gold[1]:
			gold[1] = k
	if n0 == n + 1:
		if r0 <= k < silver:
			silver = k
if gold[0] == 1:
	print(gold[1] + 1)
else:
	print(min(gold[1], silver) + 1)


n = int(input())
arr = list(map(int, input().split()))
ans = float('inf')
ai = 0
for (i, c) in enumerate(arr):
	b = (c - i + n - 1) // n
	if i + b * n < ans:
		ai = i + 1
		ans = i + b * n
print(ai)


n = int(input())
a = [int(x) for x in input().split()]
count = 0
i = 0
m = min(a)
while m > n:
	count += m - m % n
	m = m % n
while 1:
	if count >= a[i]:
		print(i + 1)
		break
	count += 1
	i = (i + 1) % n


num = int(input())
layne = input()
layne = layne.split()
layne = [int(i) for i in layne]
mx = max(layne)
dorf = mx * 2 * num
indx = 1
for i in range(num):
	dor = layne[i] // num * num
	if layne[i] % num - i > 0:
		dor = dor + num + i + 1
	else:
		dor = dor + i + 1
	if dor < dorf:
		dorf = dor
		indx = i + 1
print(indx)


n = int(input())
a = [int(x) for x in input().split()]
mn = 10000000000.0
ans = -1
for (i, x) in enumerate(a):
	t = i + (x - i + n - 1) // n * n
	if t < mn:
		mn = t
		ans = i + 1
if ans > 0:
	print(ans)
else:
	assert False


n = int(input())
a = list(map(int, input().split(' ')))
b = list()
for i in range(n):
	b.append(i + a[i] // n * n if i + a[i] // n * n >= a[i] else i + (a[i] // n + 1) * n)
min = 10000000000000000
for i in range(n):
	if b[i] < min:
		min = b[i]
		mini = i
print(mini + 1)


n = int(input())
L = [(max(0, x - i) + n - 1) // n for (i, x) in enumerate(map(int, input().split()))]
print(L.index(min(L)) + 1)


n = int(input())
l = list(map(int, input().split()))
le = len(l)
for i in range(le):
	mi = l[i]
	l[i] = l[i] // n + 1
	if mi % n > i:
		l[i] = l[i] + 1
print(l.index(min(l)) + 1)


a = int(input())
x = list(map(int, input().split()))
BoOlIk = True
counter = 1
if min(x) > a:
	counter += min(x) // a * a
x.insert(0, 0)
while BoOlIk:
	for i in range(1, a + 1):
		if x[i] < counter:
			print(i)
			BoOlIk = False
			break
		counter += 1


from math import ceil
n = int(input())
arr = map(int, input().split())
t = []
for (i, a) in enumerate(arr):
	if a - i <= 0:
		print(i + 1)
		exit()
	a = a - i
	t.append((ceil(a / n), i, a % n))
t.sort()
print(t[0][1] + 1)


from sys import stdin, stdout
from math import ceil
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))
for _ in range(1):
	n = nmbr()
	a = lst()
	p = 0
	ans = float('inf')
	for i in range(n):
		turns = ceil((a[i] - i) / n)
		if turns < ans:
			ans = turns
			p = i
	print(p + 1)


import math

def elemin(elem1):
	return elem1[0]
n = int(input())
s = input().split()
for i in range(n):
	s[i] = (int(s[i]) - i) / n
	if s[i] < 0:
		s[i] = 0
	s[i] = (math.ceil(s[i]), i)
s.sort(key=elemin)
print(s[0][1] + 1)


n = int(input())
a = list(map(int, input().strip().split()))
amin = min(a)
for i in range(n):
	a[i] -= amin
ans = amin % n
cnt = 0
while True:
	if a[ans] <= cnt:
		break
	ans = (ans + 1) % n
	cnt += 1
print(ans + 1)


n = int(input())
A = [int(num) for num in input().split()]
B = []
for (i, j) in enumerate(A):
	if j - i <= 0:
		B.append((1, i))
	elif (j - i) % n != 0:
		B.append(((j - i) // n + 2, i))
	else:
		B.append(((j - i) // n + 1, i))
x = sorted(B, key=lambda t: (t[0], t[1]), reverse=False)
print(x[0][-1] + 1)


import math

def solve():
	ans_i = 0
	i = 0
	while i < n:
		a[i] = math.ceil((a[i] - i) / n)
		if a[i] < a[ans_i]:
			ans_i = i
		i += 1
	return ans_i + 1
n = int(input())
a = list(map(int, input().split()))
print(solve())


n = int(input())
a = list(map(int, input().split()))
b = [0] * n
for i in range(n):
	if i + 1 > a[i]:
		b[i] = i + 1
	else:
		q = (a[i] - (i + 1) + n) // n
		b[i] = i + 1 + q * n
print(b.index(min(b)) + 1)


import math
n = int(input())
lines = []
raw = input().split(' ')
for i in range(n):
	lines += [int(raw[i]) - i]
	lines[i] = math.ceil(lines[i] / n)
door = 0
minimum = min(lines)
for i in range(n):
	if minimum == lines[i]:
		door = i + 1
		break
print(door)


n = int(input())
l = list(map(int, input().split()))
t = min(l)
for i in range(n):
	l[i] = l[i] - t
pointer = t % n
k = 1
while l[pointer]:
	if l[pointer] - k + 1 <= 0:
		break
	l[pointer] = max(l[pointer] - k, 0)
	k = k + 1
	pointer = pointer + 1
	pointer = pointer % n
print(pointer + 1)


import math
(n, a, m, res) = (int(input()), [*map(int, input().split())], 10000000000.0, -1)
k = [math.ceil((ai - i) / n) for (i, ai) in enumerate(a)]
print(k.index(min(k)) + 1)


n = int(input())
a = [int(i) for i in input().split()]
i = 0
b = []
c = []
for i in range(n):
	j = i + 1
	t = a[i] - j
	t = t // n + 1
	b.append(j + t * n)
	c.append(j)
print(c[b.index(min(b))])


import math
n = int(input())
arr = list(map(int, input().split()))
k = 100000000000000000000
for i in range(n):
	temp = math.ceil((arr[i] - i) / n)
	if temp < 0:
		temp = 0
	if temp < k:
		ans = i + 1
		k = temp
print(ans)


n = int(input())
arr = list(map(int, input().split()))
mn = min(arr)
pos = mn % n
val = mn
for _ in range(n):
	if arr[pos] <= val:
		ans = pos
		break
	pos = (pos + 1) % n
	val += 1
print(ans + 1)


class vertex:

	def __init__(self, ind, value):
		self.ind = ind
		self.value = value
n = int(input())
a = [int(i) for i in input().split()]
mini = a[0]
for i in range(1, n):
	if mini == 0:
		mini = a[i]
	if a[i] < mini and a[i] != 0:
		mini = a[i]
if mini == 0:
	print(1)
else:
	pointer = (mini - 1) % n
	ans = 0
	for i in range(n + 1):
		if pointer < n:
			if a[pointer] < mini:
				ans = pointer
				flag = 1
				break
		pointer += 1
		if pointer == n:
			pointer = 0
		mini += 1
	print(ans + 1)


import math
n = int(input())
a = list(map(int, input().split()))
k = []
mn = 10000000000
for i in range(n):
	sm = 0
	sm = i
	sm = math.ceil((a[i] - i) / n)
	if sm < mn:
		mn = sm
		ind = i
print(ind + 1)


n = int(input())
lst = list(map(int, input().split()))
mn = min(lst)
for (i, x) in enumerate(lst):
	lst[i] -= mn
(item, k, a) = (mn % n, 0, 0)
for i in range(item, n):
	if lst[i] - a <= 0:
		print(i + 1)
		k = 1
		break
	a += 1
if k == 0:
	for i in range(item):
		if lst[i] - a <= 0:
			print(i + 1)
			k = 1
			break
		a += 1


import sys
from math import ceil
alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

def input():
	return fast_reader().strip()

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')

def find(s1, s2):
	for i in alpha:
		if i != s1 and i != s2:
			return i
for _ in range(1):
	n = int(input())
	l = list(map(int, input().split()))
	f = False
	m = 10 ** 10
	ans = -1
	for i in range(n):
		if i + 1 > l[i]:
			ans = i + 1
			break
		else:
			pp = ceil((l[i] - i) / n)
			if pp < m:
				m = pp
				ans = i + 1
	print(ans)


N = int(input())
a = list(map(int, input().split()))
c = 9999999999999999999999999
e = 0
for i in range(N):
	b = a[i] // N
	c = min(b, c)
c = c * N
for i in range(N):
	a[i] = a[i] - i - c
	if a[i] <= 0:
		e = 1
		break
if e == 1:
	print(i + 1)
else:
	for i in range(N):
		a[i] = a[i] - N
		if a[i] <= 0:
			break
	print(i + 1)


def main():
	n = int(input())
	people = list(map(int, input().split()))
	to_min = 10000000000.0
	for i in range(n):
		to_min = min(to_min, people[i] // n)
	for i in range(n):
		people[i] -= n * to_min
		if people[i] <= i:
			print(i + 1)
			return
		else:
			people[i] -= n
	for i in range(n):
		if people[i] <= i:
			print(i + 1)
			return
main()


a = int(input())
b = list(map(int, input().split()))
minimum = min(b)
to = min(b) // a * a
b = [k - to for k in b]
for k in range(1000000):
	allen = b[k % a]
	if allen - k <= 0:
		print(k % a + 1)
		break


n = int(input())
a = list(map(int, input().split()))
b = a[:]
for i in range(n):
	b[i] = a[i] - a[i] % n + i
	if b[i] < a[i]:
		b[i] += n
mn = 0
for i in range(n):
	if b[mn] > b[i]:
		mn = i
print(mn + 1)


import sys
import math
N = int(input())
a = input()
A = a.split(' ')
twod_list = []
for i in A:
	twod_list.append(int(i))
Min = sys.maxsize
Final = 0
for i in range(N):
	Counter = 0
	Val = math.ceil((twod_list[i] - (i + 1)) / N)
	NewVal = Val * N + (i + 1)
	if (twod_list[i] - (i + 1)) % N == 0:
		NewVal = NewVal + N
	if Min > NewVal and NewVal > twod_list[i]:
		Min = NewVal
		Final = i + 1
print(Final)


n = int(input())
a = list(map(int, input().split()))
m = 100000000000
d = -1
for i in range(n):
	t = ((a[i] - 1 - i) // n + 1) * n + i
	if t < m:
		m = t
		d = i + 1
print(d)


n = int(input())
a = [int(x) for x in input().split()]
m = min(a)
k = m % n
l = a.index(m)
flag = 0
for i in range(n):
	a[i] -= m
if k <= l:
	p = 0
	for i in range(k, l + 1):
		a[i] -= p
		p += 1
		if a[i] <= 0:
			ans = i
			flag = 1
			break
else:
	p = 0
	for i in range(k, n):
		a[i] -= p
		p += 1
		if a[i] <= 0:
			ans = i
			flag = 1
			break
	if flag == 0:
		for i in range(0, l + 1):
			a[i] -= p
			p += 1
			if a[i] <= 0:
				ans = i
				flag = 1
				break
print(ans + 1)


n = int(input())
moves_to_and_i = 0
res = 1
res_val = 10 ** 10
for x in input().split():
	cur_val = (max(0, int(x) - moves_to_and_i) - 1) // n + 1
	moves_to_and_i += 1
	if cur_val < res_val:
		res = moves_to_and_i
		res_val = cur_val
print(res)


from math import ceil
n = int(input())
a = [int(x) for x in input().split()]
for i in range(n):
	a[i] = ceil((a[i] - i) / n)
k = min(a)
print(a.index(k) + 1)


from __future__ import print_function
import sys
import math
import os.path
import random
from copy import deepcopy
from functools import reduce
from collections import Counter, ChainMap, defaultdict
from itertools import cycle, chain
from queue import Queue, PriorityQueue
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, nlargest, nsmallest
import bisect
from statistics import mean, mode, median, median_low, median_high
sys.setrecursionlimit(10 ** 9)

def log(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)

def ni():
	return map(int, input().split())

def nio(offset):
	return map(lambda x: int(x) + offset, input().split())

def nia():
	return list(map(int, input().split()))

def toString(aList, sep=' '):
	return sep.join((str(x) for x in aList))

def toMapInvertIndex(aList):
	return {k: v for (v, k) in enumerate(aList)}

def sortId(arr):
	return sorted(range(arr), key=lambda k: arr[k])
(n,) = ni()
a = nia()
nround = min(a) // n
for i in range(n):
	a[i] = max(0, a[i] - i - nround * n)
ma = min(a)
if ma > 0:
	for i in range(n):
		a[i] = max(a[i] - n, 0)
print(a.index(0) + 1)


n = int(input())
s = list(map(int, input().split()))
r = 0
k = -1
counter = True
for i in range(n):
	fullkrug = s[i] // n + 1
	if s[i] % n > i % n:
		fullkrug += 1
	s[i] = fullkrug
	if fullkrug == 1:
		print(i + 1)
		counter = False
		break
if counter:
	z = min(s)
	print(s.index(z) + 1)


n = int(input())
ckn = list(map(int, input().split()))
ckn = [ckn[i] + n - i for i in range(n)]
dkn = [(ckn[i] // n + (ckn[i] % n > 0), i) for i in range(n)]
d = min(dkn)
print(d[1] + 1)


n = int(input())
a = list(map(int, input().split()))
k = []
for i in range(len(a)):
	a[i] -= i
	k.append(i)
	if a[i] > 0:
		k[len(k) - 1] += a[i] // n * n
		a[i] -= a[i] // n * n
	if a[i] > 0:
		k[len(k) - 1] += n
m = k[0]
p = 0
for i in range(1, len(k)):
	if m > k[i]:
		m = k[i]
		p = i
print(p + 1)


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	if a[i] % n <= i:
		a[i] = a[i] - a[i] % n + i
	else:
		a[i] = a[i] - a[i] % n + i + n
minDate = 10 ** 10
minId = 0
for i in range(n):
	if a[i] < minDate:
		minDate = a[i]
		minId = i + 1
print(minId)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	best = None
	best_i = None
	for i in range(n):
		r = (max(0, a[i] - i) + n - 1) // n
		cur = r * n + i
		if best is None or best > cur:
			best = cur
			best_i = i + 1
	print(best_i)
main()


n = int(input())
a = [int(i) for i in input().split()]
posrjes = []
for i in range(n):
	posrjes.append((a[i] // n + (a[i] % n > i)) * n + i)
posrjes.sort()
print(posrjes[0] % n + 1)


n = int(input())
a = [int(_) for _ in input().strip().split()]
mini = min(a)
a = [_ - mini for _ in a]
pos = mini % n
count = 0
while True:
	if a[pos] - count <= 0:
		print(pos + 1)
		break
	else:
		count += 1
		pos = (pos + 1) % n


n = int(input())
l = list(map(int, input().split()))
n = len(l)
k = [0] * n
for i in range(n):
	k[i] = (l[i] - i) // n
	if (l[i] - i) % n != 0:
		k[i] = k[i] + 1
print(k.index(min(k)) + 1)


import math
n = int(input())
a = []
t = [0 for i in range(n)]
e = 0
temp = input()
a = temp.split()
for i in range(len(a)):
	t[i] = math.ceil((int(a[i]) - i) / n)
	if t[i] == 0:
		e = i
		break
	elif t[i] < t[e]:
		e = i
e += 1
print(e)


a = int(input())
b = list(map(int, input().split()))
m = 10000000000000
j = 0
for i in range(a):
	k = b[i] - i
	if k <= 0:
		exit(print(i + 1))
	r = (k + a - 1) // a
	if r < m:
		m = r
		j = i
print(j + 1)


n = int(input())
a = list(map(int, input().split()))
b = -1
ind = -1
for i in range(n):
	c = (a[i] - i + n - 1) // n
	if b > c or b == -1:
		(ind, b) = (i, c)
print(ind + 1)


c = int(input())
g = list(map(int, input().split()))
red = [(x - i + c - 1) // c for (i, x) in enumerate(g)]
print(red.index(min(red)) + 1)


def check(x):
	global n, a
	k = x // n
	y = max(0, k - 1)
	if y > 0:
		for i in range(n):
			if a[i] - y * n <= 0:
				return False
	q = x % n
	if k > 0:
		q += n
	for i in range(q):
		if a[i % n] - y * n - i <= 0:
			return False
	return True
n = int(input())
a = [int(i) for i in input().split()]
l = 0
r = 10 ** 9 + 1
ans = 0
while r - l > 1:
	x = (l + r) // 2
	if check(x) == True:
		l = x
	else:
		r = x
print(l % n + 1)


import math
from collections import Counter
L = lambda : list(map(int, input().split()))
M = lambda : map(int, input().split())
I = lambda : int(input())
IN = lambda : input()

def s(a):
	print(''.join(list(map(str, a))))
n = I()
a = L()
b = []
for i in range(n):
	b.append(math.ceil((a[i] - i) / n))
print(b.index(min(b)) + 1)


n = int(input())
arr = list(map(int, input().split()))
minimum = 1000000000.0
ans = -1
for i in range(n):
	arr[i] = (arr[i] - i + n - 1) // n
	if arr[i] < minimum:
		minimum = arr[i]
		ans = i + 1
print(ans)


def queue():
	n = int(input())
	temp = input().split(' ')
	for i in range(len(temp)):
		temp[i] = int(temp[i])
	t = min(temp)
	while True:
		num = t % n
		if temp[num] - t <= 0:
			print(num + 1)
			break
		t += 1
queue()


n = int(input())
a = [int(x) for x in input().split()]
min_arrival = (100000000000, -1)

def circ_dist(fr, to):
	if fr <= to:
		return to - fr
	else:
		return n - (fr - to)
for (i, q) in enumerate(a):
	pos_when_first = q % n
	dist_to_entrance = circ_dist(pos_when_first, i)
	time = q - 1 + dist_to_entrance
	min_arrival = min(min_arrival, (time, i))
print(min_arrival[1] + 1)


n = int(input())
a = list(map(int, input().split()))
mn = 10000000000
ans = -1
from math import ceil
for i in range(n):
	b = a[i] - i
	c = int(ceil(b / n))
	cc = n * c
	if n * c < mn:
		mn = n * c
		ans = i + 1
print(ans)


l = int(input())
a = [int(i) for i in input().split()]
ans = [0] * l
count = 0
for s in range(l):
	if a[s] < s + 1:
		count = s + 1
		break
	ok = a[s] - s
	ans[s] = s
	if ok % l == 0:
		ans[s] += ok
	else:
		ans[s] += ok - ok % l + l
if count != 0:
	print(count)
else:
	print(ans.index(min(ans)) + 1)


import math
num_q = int(input())
queue_sizes = [int(x) for x in input().split()]
min_idx = 0
min_visits = 1000000000000000000000
for j in range(len(queue_sizes)):
	if math.ceil((queue_sizes[j] - j) / len(queue_sizes)) < min_visits:
		min_visits = math.ceil((queue_sizes[j] - j) / len(queue_sizes))
		min_idx = j
print(min_idx + 1)


N = input()
N = int(N)
entrance = input().split()
mod_entrance = [int(int(x) / N) for x in entrance]
minimum_cycle = min(mod_entrance) * N
if minimum_cycle is not 0:
	entrance = [int(x) - int(minimum_cycle) for x in entrance]
temp = []
for i in range(N):
	temp.append(int(i))
i = 0
while 1:
	if i is N:
		i = 0
		entrance = [int(x) - int(N) for x in entrance]
	answer = int(entrance[i]) - int(temp[i])
	i += 1
	if answer < 0 or answer == 0:
		print(i)
		break


def main():
	n = int(input())
	a = [x for x in map(int, input().split())]
	ans = 10 ** 10
	ansi = n
	for i in range(len(a)):
		x = a[i]
		if a[i] % n <= i:
			x += i - a[i] % n
		else:
			x += n - (a[i] % n - i)
		if ans > x:
			ans = x
			ansi = i
	print(ansi + 1)
main()


n = int(input())
a = list(map(int, input().split()))
x = min(a) // n * n
s = x
for i in range(n):
	a[i] -= x
for i in range(2 * n):
	if a[i % n] <= i:
		print(i % n + 1)
		exit()


n = int(input())
arr = list(map(int, input().split()))
arrx = []
for i in arr:
	arrx.append(i // n)
ans = 0
arry = []
for i in range(n):
	k = arrx[i] * n
	if arr[i] - k <= i:
		k += i + 1
	else:
		k += n + i + 1
	arry.append(k)
print(arry.index(min(arry)) + 1)


import math
n = int(input())
li = [int(x) for x in input().split()]
x = min(li) // n
for i in range(n):
	if li[i] - x * n - i <= 0:
		print(i + 1)
		quit()
for i in range(n):
	if li[i] - (x + 1) * n - i <= 0:
		print(i + 1)
		quit()


def go():
	n = int(input())
	a = [int(i) for i in input().split(' ')]
	minn = float('inf')
	index = None
	for i in range(n):
		x = a[i] // n
		if a[i] - x * n - i <= 0:
			if x < minn:
				minn = x
				index = i
		elif x + 1 < minn:
			minn = x + 1
			index = i
	return index + 1
print(go())


import math
n = int(input())
a = list(map(int, input().split()))
(s, ans) = (10000000000.0, 0)
for (i, x) in enumerate(a):
	if math.ceil((x - i) / n) < s:
		ans = i + 1
		s = math.ceil((x - i) / n)
print(ans)


import math
from sys import exit
import math
n = int(input())
a = list(map(int, input().split()))
zz = [0] * n
jj = [j for j in range(n)]
for i in range(len(a)):
	z = a[i] - i
	if z <= 0:
		print(i + 1)
		exit()
	zz[i] = math.ceil(z / n)
	z = z % n
	a[i] = z
ss = sorted(zip(zz, jj))
print(ss[0][1] + 1)


import math
n = int(input())
lis = list(map(int, input().split()))
ans = [0] * n
for i in range(n):
	if lis[i] < i:
		ans[i] = i
	else:
		ans[i] = math.ceil((lis[i] - i) / n) * n + i
print(ans.index(min(ans)) + 1)


import sys
input = sys.stdin.readline
n = int(input())
s = list(map(int, input().split()))
for i in range(n):
	q = s[i] % n
	if q < i:
		s[i] += i - q
	elif q > i:
		s[i] += n - (q - i)
ind = 0
for i in range(n):
	if s[i] < s[ind]:
		ind = i
print(ind + 1)


n = int(input())
a = [int(i) for i in input().split(' ')]
kp = min(a) // n
i = 0
p = kp * n
while a[i] > p:
	p += 1
	if i == n - 1:
		i = 0
	else:
		i += 1
print(i + 1)


n = int(input())
ta = input().split()
a = [0]
for i in ta:
	a.append(int(i) + n)
mn = 1000000000000000000
mner = 1
for i in range(1, n + 1):
	if (a[i] - i) // n < mn:
		mn = (a[i] - i) // n
		mner = i
print(mner)


n = int(input())
a = list(map(int, input().split()))
y = sorted(a)
if y[0] >= n:
	r = y[0] - y[0] % n
	for i in range(n):
		a[i] -= r
i = 0
count = 1
while a[i % n] - i > 0:
	i += 1
print(i % n + 1)


from math import ceil

def main():
	n = int(input())
	a = list(map(int, input().split()))
	found = False
	for i in range(n):
		if a[i] <= i:
			found = True
			index = i + 1
			break
	if not found:
		temp = ceil(a[0] / n)
		index = 1
		for i in range(1, n):
			if ceil((a[i] - i) / n) < temp:
				temp = ceil((a[i] - i) / n)
				index = i + 1
	print(index)
main()


n = int(input())
a = list(map(int, input().split()))
ans = 1000000000
for i in range(n):
	r = a[i] % n
	t = 0
	if r <= i:
		t = a[i] + (i - r)
	else:
		t = a[i] + (n - r) + i
	t = max(t, i)
	ans = min(ans, t)
print(ans % n + 1)


x = int(input())
A = input().split()
mini = 10000000000
ans = 0
for i in range(0, x):
	cur = int(A[i])
	kiedy = cur // x * x
	cur %= x
	if cur <= i:
		kiedy += i
	else:
		kiedy += x
	if kiedy < mini:
		mini = kiedy
		ans = i
print(ans + 1)


n = int(input())
l = [int(x) for x in input().split()]
d = {}
m = l[0] // n
for i in range(n):
	d[i] = [l[i] // n, l[i] % n]
	if m > l[i] // n:
		m = l[i] // n
j = -1
for i in range(n):
	if d[i][0] == 0 and d[i][1] < i + 1:
		print(i + 1)
		break
	elif d[i][0] == m:
		if j == -1:
			j = i
		if d[i][1] < i + 1:
			print(i + 1)
			break
else:
	t = d[j][0] + 1
	for k in range(j):
		if d[k][0] == t and d[k][1] == 0:
			print(k + 1)
			break
	else:
		print(j + 1)


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var):
	print(*var, file=sys.stderr)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(n,) = I()
a = I()
m = min(a)
i = a.index(m)
pos = m % n
for i in range(pos, pos + n + 1):
	cur = i % n
	debug(a[cur] - m - i + pos, cur)
	if a[cur] - m - (i - pos) <= 0:
		ans = cur
		break
print(ans + 1)


n = int(input())
arr = list(map(int, input().split()))
mi = arr[0]
ind = 0
for i in range(n):
	if arr[i] < mi:
		mi = arr[i]
		ind = i
kol = mi
pol = kol % n
for i in range(n):
	if kol >= arr[pol]:
		break
	kol += 1
	pol = (pol + 1) % n
print(pol + 1)


from sys import stdin

def solve(tc):
	n = int(stdin.readline().strip())
	li = list(map(int, stdin.readline().split()))
	ans = 1
	mini = 1000000000.0
	for i in range(n):
		k = li[i] // n
		if li[i] % n > i:
			k += 1
		if k < mini:
			mini = k
			ans = i + 1
	print(ans)
LOCAL_TEST = not __debug__
if LOCAL_TEST:
	infile = __file__.split('.')[0] + '-test.in'
	stdin = open(infile, 'r')
tcs = int(stdin.readline().strip()) if LOCAL_TEST else 1
tc = 1
while tc <= tcs:
	solve(tc)
	tc += 1


input()
queue = list(map(int, input().split()))
t = len(queue)
base = min(queue)
minu = int(base / t) * t
while queue[minu % t] > minu:
	minu += 1
print(minu % t + 1)


from functools import cmp_to_key
n = int(input())
s = input()
s = s.split(' ')
mi = 2000000001
p = 0
for i in range(0, n):
	now = int(s[i])
	xx = (now - i) // n
	if n * xx + i < now:
		now = n * xx + i + n
	if now < mi:
		p = i + 1
		mi = now
print(p)


value = 0
number = int(input())
entrances = [int(x) for x in input().split()]
turn_list = []
for i in range(number):
	remainder = entrances[i] - i
	if remainder <= 0:
		print(i + 1)
		value = 1
		break
	if remainder % number == 0:
		turns = int(remainder / number)
	else:
		turns = int(remainder / number) + 1
	turn_list.append(turns)
if value == 0:
	print(turn_list.index(min(turn_list)) + 1)


n = int(input())
a = list(map(int, input().split()))
mn = 10 ** 10
id = -1
for i in range(n):
	nmn = 0
	if a[i] - i > 0:
		nmn = 1 + (a[i] - i + n - 1) // n
	if nmn < mn:
		mn = nmn
		id = i
print(id + 1)