eval'A='+gets.split*?, p (0..A.max).bsearch{|i|A.map{|a|d=a-i;(d>0?d/2:d)*2}.sum<0}-1