#!/usr/bin/env python3
n = input()
a = list(map(int, input().split()))
m = min(a)
a.remove(m)
print(m + min(a))
