#include <bits/stdc++.h>
using namespace std;

int main() {
 /*
 Optimization over priority-queue algorithm :- 

If(largest>=(tot_sum)/2){answer = largest;}
else{
-> answer = tot_sum/2; (conditions applied)
}

 */
 int n ;
 cin>>n;
 
 vector<int>a(n);
 for(int i = 0 ;i < n ;i++){
 	cin>>a[i];
 }
 int ans = 0 ;
 int x = *max_element(a.begin(),a.end());
 int y = accumulate(a.begin(),a.end(),0);

 if(x>=y/2){
 	ans = x;
 }else{
 	 if(y%2==0){
 	ans = y/2;
 	 	
 	 }else{
 	 	ans = y/2+1;
 	 }
 }
 
 cout<<ans<<endl;
	return 0;
}