#!/bin/python3 import sys n = int(input().strip()) types = list(map(int, input().strip().split(' '))) # your code goes here for i in range (n-1): types[types[i] % n] += 6 max = types[0] index = 0 for x in range (n-1): if types[x] > max: max = types[x] index = i print(index)