using System;
using System.Linq;

public class Program{
    public static void Main(){
        int[] numbers = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        int[] prices = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        
        Console.WriteLine(prices.OrderBy(a => a).Take(3).Sum());
    }
}
