## constant

MAX_INT = 1 << 31

### main

n = gets.strip.to_i

as = [MAX_INT, MAX_INT, MAX_INT, MAX_INT]

n.times do
  ai = gets.strip.to_i
  as << ai
  as.sort!.pop
end
#p as

aas = []

for i in (0...as.length)
  ai = as[i].to_s
  for j in ((i + 1)...as.length)
    next if i == j
    aj = as[j].to_s
    aas << (ai + aj).to_i
    aas << (aj + ai).to_i
  end
end

puts aas.sort[2]