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

Solutions:
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)


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)


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)


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)


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)


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 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
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())
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()))
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)


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)


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)


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())
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


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


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)


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()


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)


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)


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)


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()))
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


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)


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)


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


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)


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 = 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)