importjava.io.*;importjava.util.*;publicclassEvenMoreOddPhotos{publicstaticintgroup(intO,intE){intdiff=O-E;if(diff==0){returnO+E;}elseif(diff==1){returnO+E-2;}elseif(diff==2){returnE+O-1;}else{O-=2;E+=1;}returngroup(O,E);}publicstaticvoidmain(String[]args)throwsIOException{EvenMoreOddPhotos.Kattioio=newEvenMoreOddPhotos.Kattio();intN=io.nextInt();intoddC=0,evenC=0;for(inti=0;i<N;i++){intcow=io.nextInt();if(cow%2==0){evenC+=1;}else{oddC+=1;}}if(evenC>oddC){io.println(2*oddC+1);}else{io.println(group(oddC,evenC));}io.close();}// https://usaco.guide/general/io?lang=java#io-templatestaticclassKattioextendsPrintWriter{privateBufferedReaderr;privateStringTokenizerst;// standard inputpublicKattio(){this(System.in,System.out);}publicKattio(InputStreami,OutputStreamo){super(o);r=newBufferedReader(newInputStreamReader(i));}// USACO-style file inputpublicKattio(StringproblemName)throwsIOException{super(newFileWriter(problemName+".out"));r=newBufferedReader(newFileReader(problemName+".in"));}// returns null if no more inputpublicStringnext(){try{while(st==null||!st.hasMoreTokens())st=newStringTokenizer(r.readLine());returnst.nextToken();}catch(Exceptione){}returnnull;}publicintnextInt(){returnInteger.parseInt(next());}publicdoublenextDouble(){returnDouble.parseDouble(next());}publiclongnextLong(){returnLong.parseLong(next());}}}