// Arup Guha
// 11/6/2016
// Solution to 2016 SER D2 Problem: Mismatched Socks

import java.util.*;

public class socks {

	public static void main(String[] args) {

		// Read in all the values and sort.
		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();
		long[] vals = new long[n];
		for (int i=0; i<n; i++)
			vals[i] = stdin.nextLong();
		Arrays.sort(vals);

		// Figure out all the "other socks"
		long allButLast = 0;
		for (int i=0; i<n-1; i++)
			allButLast += vals[i];

		// Everything matches with the most frequent sock.
		if (allButLast < vals[n-1])
			System.out.println(allButLast);

		// A mod wrapping argument shows that we can make a maximum number of mismatched pairs.
		else
			System.out.println((allButLast+vals[n-1])/2);
	}
}