#41911: python解


chenwei980503@gmail.com (陳維(Z))


n=int(input())
a=[int(x) for x in input().split()]
c=[]
for i in a:
c.append(int(str(i)[::-1]))# 將當前的整數 i 轉換為字符串,然後使用 [::-1] 將字符串反轉。接著,將反轉後的字符串轉換回整數,並將其添加到列表 c 中。
print(max(c))