#!/usr/bin/env python3
input(), print(sum(sorted([int(i) for i in input().split()])[:2]))
