#関数リスト
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

n = I()
mylist = LI()
buy = [0] * n

if n == 2:
    if mylist[0] >= mylist[1]:
        print(1000)
    else:
        stock = 1000 // mylist[0]
        print(1000+stock*(mylist[1] - mylist[0]))
    sys.exit()

katamuki = 0
for i in range(n-1):
    if katamuki == 0:
        if mylist[i+1] > mylist[i]:
            buy[0] = "buy"
        elif mylist[i+1] < mylist[i]:
            katamuki = -1
    if katamuki == -1 and mylist[i+1] > mylist[i]:
        buy[i] = "buy"