Problem:


Score : 400 points

Problem Statement

Snuke has decided to play a game using cards.
He has a deck consisting of N cards. On the i-th card from the top, an integer A_i is written.

He will perform the operation described below zero or more times, so that the values written on the remaining cards will be pairwise distinct. Find the maximum possible number of remaining cards. Here, N is odd, which guarantees that at least one card can be kept.

Operation: Take out three arbitrary cards from the deck. Among those three cards, eat two: one with the largest value, and another with the smallest value. Then, return the remaining one card to the deck.

Constraints

3 ≦ N ≦ 10^{5}

N is odd.

1 ≦ A_i ≦ 10^{5}

A_i is an integer.

Input

The input is given from Standard Input in the following format:

N
A_1 A_2 A_3 ... A_{N}

Output

Print the answer.

Sample Input 1

5
1 2 1 3 7

Sample Output 1

3

One optimal solution is to perform the operation once, taking out two cards with 1 and one card with 2. One card with 1 and another with 2 will be eaten, and the remaining card with 1 will be returned to deck. Then, the values written on the remaining cards in the deck will be pairwise distinct: 1, 3 and 7.

Sample Input 2

15
1 3 5 2 1 3 2 8 8 6 2 6 11 1 1

Sample Output 2

7



Sample input:
5
1 2 1 3 7


Sample output:
3

Submission status: Accepted

Solution code:
# This code is generated by [Atcoder_base64](https://github.com/kyomukyomupurin/AtCoder_base64)
import base64
import subprocess


exe_bin = "e??420s#R400000000000{}h%0RR91@C^U}00000KmY&$00000U@rgw0000000000Kma%Z2>?I<9snHx1^@s61ONa4KmY&$00000KmY&$00000KmY&$00000_yGU_00000_yGU_000002mk;8000000{{R31ONa4I066w00000I066w00000I066w000008~^|S000008~^|S000000RR91000000RR911poj5000000000000000000000000000000Vio`Z00000Vio`Z00000001BW000000RR911^@s6FdYB@00000FdZNO00000FdZNO00000=mG!$00000NCp4^00000001BW000000ssI21^@s6NF4wG00000NF5*m00000NF5*m000005CQ-I000005CQ-I000002mk;8000001ONa41ONa4R004100000R004100000R004100000L;wH)00000L;wH)000001ONa400000P~~)F1ONa4WD@`Y00000WD@`Y00000WD@`Y00000WB>pF00000WB>pF000001ONa400000QRQ@G1^@s6000000000000000000000000000000000000000000000000005C8xG00000Qss1H1ONa4FdYB@00000FdZNO00000FdZNO00000&;kGe00000&;kGe000000RR9100000FKlUIHZ(76WG!rIZgqGqcsMpKHZ(4CZ!R(b1ONa45C8xG0RR91M^04$000000{{R30ssI2000001ONa46aWAK0{{R3M^04$(Idwe?3DA?0bf;Y2+~1B2cVIj0{{R36aWAK0RR911^@s6000mIApjHr6aWAK00000761SMa+U`IC2b5t6_^Y|0000000000000000000000000000009RUCU5&!@I00000000000000000000zySaNA^-pY00000000000000000000;s5{u5&!@I00000000000000000000i2wiq5&!@I00000000000000000000vjG4A5&!@I00000000000000000000f&c&j5&!@I00000000000000000000SOEY45&!@I00000000000000000000q5%K^5&!@I00000000000000000000lmGw#5&!@I00000000000000000000HUR(t5&!@I00000000000000000000&jA1c5&!@I00000000000000000000Z2$lO5&!@I00000000000000000000aRC4T5&!@I000000000000000000009{>OVAOHXW00000000000000000000i2(or5&!@I00000000000000000000*8u<k5&!@I000000000000000000005C8xGAOHXW00000000000000000000I{*LxAOHXW00000000000000000000RR9105&!@I00000000000000000000UI73A5dawgKp`Li000007y$qP00000P5}S_5dawgU?Ly@000005CH%H00000X8`~J5dawgARr(B000005CH%H000000BmVub97{5D=RK@Z!R_fUtec!Z*E_6bYXIIUta)UNmNZ=WMy(?XK8bEWpY$aLu_wuWmI8eY-IpnNmNZ=a%E>}b97~LR82!{Z*FB&VPb4$0AE^8Q*=0KZ*yN_VRL0PNp5L$L@`Bn0AF8ccz9oMWpZ<GZeeU`ba`KPFaTd#WNc7&0AE^8Q)zN@MN(-1Us_XiF*aXcZ*z2VWnpb!X>N06a&$>!Q*<#gV`yP=UvzR|X>@Z*V?{+$Q*<#iVqtS>V_$D`baG{3ZAnyLR4`vfQ#M~vOH(snYye+cQ*<<CZe(mpV^ef7F=J?9a$j_EVQF-8Nn=GtQd4v>Gh$(LX=7h+b98cLVQooNUsNz(MN>9k0AE^DbTKzyUvy}4Z+Bl}VPs!nY;131b^u>mPE&L^X>W61VqtS-G)Zo0bVD&kb^u>mQ*<<AWpZ)=Us`T=Z2(_dQ*<+9X>I^tT2pj1V{dhI0AE^8Q*Uf@MQH$RX<}z%V_$PFb8jv&0AE#ZcWG{9Us7drb!}w;Y-wU+E^}`#HUM8=b97;2YhPn%YhPwzX>0&rUt@S-Utx4*cxiM1UteQ*VP9rxZeeU`dSw7@Wo>P5c4YuxUu<b&V_$Q0VRCd|ZDDC{07pYZUo$Q+07pzoLPK9NE;Il~Oi4mRUotK-E;Rr{SXe<qNnbH8GXO_SNkT(dSYI<PG%h&+M@&gVLs(c}GcGg$000620{{X50ssR50ssO41ONp90ssR51^@y8000L70{{R3000620ssO40ssI2000000RRC2djS9d5C8xGAOHXWP$qc`000L7=>Y%$000000RRF3m;nF)5C8xGFaQ7m6lrM<000C4@c{q;5C8xGbsA|200093`vCv|000000RRI40RR915C8xG00000)30j<000I62Lb>95C8xGiGL{q000F55&{4K5C8xGbSaVu00062AOZjY00000FdZNO000002mk;800000@D2a~00000I2|AW000002mk;800000zzqNZ00000Kph|e000002mk;800000unqtK000002p}K;000002mk;8000002p}K;00000&>tWG000001^@s60ssI20000000000*dHJO000001^@s64gdfE0000000000;2$6W000001^@s65C8xG0000000000=pP^e000001^@s65dZ)H0000000000@E;%m000001^@s65&!@I0000000000_#Yqu000001^@s66951J00000000005Fj7`000000RR913;+NC0000000000ARr(B000001poj5761SM0000000000Kp`Li000001poj56aWAK0000000000U?Ly@000001poj56#xJL0000000000a33H5000002LJ#70RR910000000000cpo4D000002LJ#70{{R30000000000fFB?L000002LJ#71ONa40000000000h#w#T000002LJ#71poj50000000000kRKob000002LJ#71^@s60000000000m>(bj000002LJ#72LJ#70000000000pdTOr000002LJ#72mk;80000000000s2?Bz000002LJ#72><{90000000000upb}*000002LJ#73IG5A0000000000xE~+@000002LJ#73jhEB0000000000z#kw0000002LJ#74FCWD0000000000$R8j8000002LJ#74*&oF0000000000NQ3MMNQ(uH6(9geg}`(I|IkQ-#0bLx0000000000|266qAOQa*>=YmX4<A4P|0U`aAOL6p0002#;Q#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28IQU1dRiZ0ssI2Gynhq$N&HU?EL@#D**ri07ecFjRHar7>ol%4j_gEK@KQ`1p>4R4j@4e7(xyZLJkN@3jhEBQ~&?~00961RQmt_wE+MC074EBjsijs7>xr+4j_yKK@KQ}1w;-og9ZaH0S-7x4nR*1I6)3DRSq~+4nR&0I6)3DLkbQkK@K274j4iX5JC<JK??u?8~^|S000000eVnOQUC#X5C@yF3LpR*8w>{skO2SyU;qFBBme*a-1YzeVgdjF1j_&b074EBjsijs7>xr-4j_yKK@KQ}1wjrlg9bznKmx`NNJ$P*Ob$pv4nPA30SXQ<K@KQE4j@7f7(xyZLJkN)3q%e`NDfd&4oE=`KmY&$6aWAK+yMXp==cBsE&u=k080)KUJeKVL;wH)^Z@_>@cjS(WdHyG074EBj{-st7>)x)4j_#LLJla51xOAsh6YFuID-dG4nT4aI6)3DK@KQF4j@7f7(xyZLJkN35C8xGJOTg!82$hM0ssI20000000000|Nj9NC^i59mI0sv(*yv%0}ZnT0Hy>t00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000@D2a~00000zzqNZ00000unqtK000000RR91000000RR91000000RR9100000djS9d000000RR9100000m;nF)000003;+NC00000PznG5000004FCWD00000R1*LI0000082|tP00000FdZNO000008vp<R000005C8xG000008UO$Q00000Kph|e000008~^|S000002mk;800000_5S~F00000m;wL*000001poj500000@B{z=000001^@s600000$N~TW000003IG5A00000ECK)k000003jhEB000007ytkO000006#xJL0000000000000000{{R300000SRWt&000000ssI200000AOQdX000006aWAK000002LJ#7000007XSbN00000FbMzv000002LJ#700000;0FKz000002mk;800000Pyqk{000002><{9000007ytkO000009smFU000002mk;800000`~UxM000000RR9900000{{R1P00000PzL}200000|NsAQ000000{{R300000@c;jB0000090vdZ00000`TzfK000001ONa4000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000NF5*m0000000000000000000000000h6(@x00000mI?p>00000rV0Q600000wh90M00000#tHxc00000)(QXs00000<_Z7+00000_6h(1000001`7ZH0000077G9X00000CJO)n00000HVXg%0000000000000000000000000000000000000000000000000000000000000000000000000002p}K;000000000000000M?*t8AShL0b#8QZAU7^GE-)=Kbz*gHbagR)F*q(TG$|lAE;TMN0000000000000000000000000000000000000000000000{{U4I066w000000000000000000000{{X5R0041000000000000000000000{{a6bOHbX000000000000000000000{{d7m;wL*000000000000000000000{{g8$N~TW000000000000000000000{{j9@B{z=000000000000000000000{{mA90vdZ000000000000000000000{{pBPzL}2000000000000000000000{{sC;0FKz000000000000000000000{{vDFbMzv000000000000000000000{{yEPznG5000000000000000000000{{#Fa0&nb000000000000000000000{{&GKnnl>000000000000000000000{{*HPzwM6000000000000000000000{{;IR1*LI000000000000000000000{{>JU=siU000000000000000000000{{^KWD@`Y000000000000000000000{{{L$P)kn000000000000000000000{{~MNEQG9000000000000000000000{|2NFdZNO000000000000000000000{|5OKph|e000000000000000000000{|8PNF5*m000000000000000000000{|BQSRWt&000000000000000000000{|ER03aX$000000000000000000000{|HSARr(B000000000000000000000{|KT000000000000000000000RR911OV~>000000000000000000005&!@I0ssyGP!9kA00000wE+MC00000kN^Mx0ssyGzzqNZ00000E&u=k00000tpET30RR~QaU&oA000000RR9100000yZ`_I1OV~>00000000000000000000#{d8T0ssyGAPxWk000000000000000$p8QV0ssyGU=9EP000000000000000+yDRo0ssyGunqtK000000000000000@&Et;0RR~Qa3df9000000RR91000000RaF20RR;MKph|e000000000000000C;<Qf0ssyG@D2a~000000000000000Gywnr0RR*LFdZNO000000000000000yZ`_I1OV~>00000000000000000000Qvm<~0RR#JL>2%5000000000000000000001OV~>00000000000000000000VF3UD000pHWD@`Y000000000000000bO8VW0RR>NNF5*m000000000000000eE|Rf000yKKph|e000000000000000jsXAw000yKFdZNO000000000000000p#cB@0RR^OSRWt&000000000000000w*deE5C9ke7$6`3000000000000000Wdr~KAOIKu03aX$000000000000000z5xIL5daVXU=siU000001ONa400000%>e)a5&!@I00000000000000000000^8o+=A^;8m5D@?X00000mjD0&00000WdZ;IA^-pY00000000000000000000fdT*k5&#YWPzwM600000VgdjF00000h5`Tp5&!@I00000000000000000000&H?}cA^;8mun_<N00000D**ri00000MFRi;5ds(h2p}K;000000000000000QUd@05&!@I00000000000000000000p8x;=5&#YW01p5F00000NdN!<00000Y6AcOAp#fx5Fj7`000002mk;800000JOuy%5&#bXR1*LI000000000000000h64Zq5&!@I00000000000000000000paTE^5&!@I00000000000000000000X#@ZO5&#YW@C^U}00000D*ylh00000v;zPD5&!@I00000000000000000000#{&QW5&!@I00000000000000000000s{{Z55&#PTPznG5000000000000000;{yNy5ds(h7$6`3000000000000000?*jk;5&!@I00000000000000000000OauS`5dawgARr(B000005CH%H00000V*~&I5C9ke03aX$000000000000000i2(or5C9nfcq1SH000000000000000a0CDV5C9nf7$6`3000000000000000d;|ah5&!@I00000000000000000000p#%T`5&#YW;1U1;00000WdHyG00000u>=4B5&!@I00000000000000000000#smNW5&!@I00000000000000000000=L7%%5&!@I00000000000000000000{saI3AOHXW000000000000000000008U+9V5&!@I00000000000000000000G6ett5&#YWP!j+E000000ssI200000LInT-5dawgKp`Li000007y$qP00000SOow85&!@I00000000000000000000cLe|dAOHXW00000000000000000000h6MlsAOHXW00000000000000000000palQ`5dawgU?Ly@000005CH%H00000w*>$I5&!@I0000000000000000000007PFyVRB?&MPYPhaxP<VZ~$LgQ*<#lUtei%baHQVZ*p{BY;SLHNlrOmUuSN0Ut@T9F*jddZf|mJVQgP%bY*g3bZ>G=P-#<iHg;uWbZ>G=X;WcIX+=dvMQlz}FkdxaUvF@8F*RRFbY*g1Y-MwEUukq@az#aUR9{m$UsNz(R54#JX>)R6E;BR$Uq?(&LP1PlUvqV0UrAqIS~+B8Vs&R<Z*_Eb0AE^DbWAv3Uukb?ZfSG?V{&wJbaiHCE@J>>WpZU_X>)XCa$j_9Ut?@<Ze?=-UteTzUuSG@Vqt7wWOQ$Gb6;U~cmQK>ZE$R5bY)~NH#Rvq0AF8ZZ(nC@Z(?C=Uu1M|a&uo{b$DN9X>Ms>VRCX|d0%C2baHtBW^!R|WnW}<ZEbk~UteZ&VQpn!WOZ$Ad0%O6X>?y<a&lpLUuAA|a(Mt>Uq(_vO+{ZtPDEc{0AF86PE}t;NMA-$K}|(pNJLTqUqo3>K}|_R0AF8eZfSI1VRCX|d0%C2WB^}ZX>MtBUtw}`VR>J3bYXII0AEK;PeMUVUr$CxQ$<u?R6#;aMPC44Wn^J=VE|uAPhWF%WNB_+b#rB80AE^DbTKzyUvy}4Z+Bl}VPs!nY;131c0fQ!Oi4mRSXf^(E;ImNT2pi}HeX+9ZgXXFbZKvHUvqDAbV*J*Utec#bzft6criC$Uv6)5ZDDL*X>?_BVRUbDNl<B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J&Za_dsOi4mRUotK-E;RsOUuSJ^ZeMeBVRCd|UjSc8R83!UWoKz~bY*f>O+##NZe>(qVr*pqUs_XiG-G9QazH>wOi4mRSXf^(E;ImNT251RIB9QlUt(c%Wi&}{X>>#}MRq_yM@&gVLs(c}GcGg$04{TRZFFH`04{TMa&%#004{TAb98caVPXI-X>N37a&Q1HZf|sDE<r*`Ep%aL04{ECbY(7QZgnnVb!lv5Eoo!`E@y6aE@)wMXaFu`d2VxgZ2&H0d2VxbasV!8ZgnnpWpZ<AZ*BlCXKr;ac4cyNX>V>{asV!JWo%(CWO;4?E^=jTVJ>iNbO0`CZfSG?E^usgE@y9a04{W8cys_RW@&C|04{QGWMOn+04`-{UuJS)ZDn6*WO4v5WoTb!a$#*{04`@^V_#)>V`Xr3Uvyz&Y-Ip0X>MtBUtw}`VR-;9W@&C|Utw}`VR-;9WO;63ZE0fwE@WYJVE`^-b8`SLV{dJ3Wo~o;00000000000000000000000000000000000000000000000000000000000000000000000000000000000008vp<R0RR910ssI200000I066w00000I066w000008~^|S0000000000000000RR91000000000000000BLDyZ2LJ#70ssI200000R004100000R004100000AOHXW0000000000000001ONa4000000000000000F#rGn2LJ#70ssI200000bOHbX00000bOHbX00000Bme*a0000000000000001ONa4000000000000000L;wH)_W%EH0ssI200000m;wL*00000m;wL*00000FaQ7m000001poj5000002mk;8000000000000000P5=M^3jhEB0ssI200000$N~TW00000$N~TW00000C;|Wg000001^@s60RR912mk;8000007ytkO00000RsaA10{{R30ssI200000@B{z=00000@B{z=00000ECK)k0000000000000000RR91000000000000000UH||9|NsAQ0ssI20000090vdZ0000090vdZ00000E&u=k000001poj5000000ssI2000000ssI200000YXATM{{R1P0ssI200000PzL}200000PzL}200000kN^Mx000001^@s60{{R32mk;8000000000000000dH?_b1ONa40ssI200000;0FKz00000;0FKz00000Pyqk{000001poj5000002mk;8000007ytkO00000ga7~l1ONa4LI3~&00000FbMzv00000FbMzv00000AOQdX000001poj57XSbN2mk;8000007ytkO00000jsO4v0RR911^@s600000PznG500000PznG5000007XSbN0000000000000001ONa4000000000000000i2wiq0RR911^@s600000a0&nb00000a0&nb00000&;S4c0000000000000005C8xG000005C8xG00000lmGw#0RR911^@s600000Knnl>00000Knnl>000002mk;80000000000000002mk;8000002mk;800000od5s;0RR911^@s600000PzwM600000PzwM6000000tf&A0000000000000005C8xG000000000000000qW}N^0RR911^@s600000R1*LI00000R1*LI000002><{90000000000000001ONa4000000000000000sQ>@~0RR915&!@I00000U=siU00000U=siU000001ONa40000000000000001ONa4000001ONa400000u>b%70RR910ssI200000WD@`Y00000WD@`Y00000WB>pF0000000000000001ONa4000000000000000zW@LL0RR910ssI200000$P)kn00000$P)kn00000fC2yj0000000000000002mk;8000000000000000$p8QV0RR910ssI200000NEQG900000NEQG9000008UO$Q0000000000000000RR91000000000000000+W-In4gdfE0{{R300000FdZNO00000FdYB@000005C8xG0000000000000002mk;8000002mk;800000=Kufz4*&oF0{{R300000Kph|e00000Kpg-8000002mk;80000000000000002mk;8000002mk;800000^8f$<1^@s60{{R300000NF5*m00000NF4wG000005CQ-I000001^@s6000002mk;8000005C8xG00000m;e9(0RR910{{R300000SRWt&00000SRViY00000r~m)}0000000000000002mk;8000002mk;800000`~Uy|0RR910{{R30000003aX$0000003ZMW000007ytkO0000000000000002mk;80000000000000000s#O32mk;80{{R300000ARr(B000007$5)u00000SOWk6000000000000000AOHXW0000000000000002LS*80RR91FaQ7m0000000000000007$5)u00000DF6Tf0000000000000000RR91000000RR91000000RR910ssI200000000000000000000NFV?J00000C<p)m000008~^|SF8}}l2mk;8000007ytkO000002><{90{{R300000000000000000000a3}x(00000+ywvt0000000000000000RR910000000000000005dZ)H0{{R300000000000000000000OfCQb000005CH%H0000000000000000RR91000000000000000"

open("./kyomu", 'wb').write(base64.b85decode(exe_bin))
subprocess.run(["chmod +x ./kyomu"], shell=True)
subprocess.run(["./kyomu"], shell=True)

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int , input().split(" ")))
mx = 100005
freq = [0]*mx
for i in range(n):
    curr = arr[i]
    freq[curr] += 1
    freq[curr]%=2
    if freq[curr] == 0:
        freq[curr] = 2
num_evens = 0
total = 0
for item in freq:
    if item != 0:
        total += 1
    if item == 2:
        num_evens += 1
if num_evens %2 == 1:
    total -= 1
print(total)

Submission status: Accepted

Solution code:
N=int(input())
*A,=map(int,input().split())

M=len(set(A))
ans=M-(N-M)%2
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
*A,=map(int,input().split())

M=len(set(A))
ans=M-(N-M)%2
print(max(ans,1))

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
A.sort()
tmp = 0
S = []
for i in range(1, N):
    if A[i] == A[i-1]:
        tmp += 1
        continue
    S.append(tmp+1)
    tmp = 0
if tmp == 0:
    S.append(1)
else:
    S.append(tmp+1)

ans = 0

for i in range(len(S)):
    while S[i] > 1:
        if S[i] >=3:
            ans += 1
            S[i] -= 2
        else:
            ans += 1
            if i+2 < len(S):
                if S[i+1] == 1 and S[i+2] > 1:
                    S[i+2] -= 1
                elif S[i+1] > 1:
                    S[i+1] -= 1
                else:
                    S[i+1] = 0
            elif i+1 < len(S):
                S[i+1] -= 1
            break
print(N-2*ans)

Submission status: Accepted

Solution code:
import collections

def main():
    N = int(input())
    A = set(map(int, input().split()))
    lenA = len(A)
    if lenA%2 == 1:
        print(lenA)
    else:
        print(lenA-1)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
s = set(A)

dif = len(A)-len(s)
if dif % 2 == 0:
  ans = len(s)
else:
  ans = len(s)-1
print(ans)

Submission status: Accepted

Solution code:

N = input()
a = list(map(int,input().split()))

a_set = set(a)

if len(a_set)%2==1:
    print(len(a_set))
else:
    print(len(a_set)-1)

Submission status: Accepted

Solution code:
from collections import Counter
N = int(input())
A = Counter(map(int, input().split()))
t = 0
for i in A.values():
    t += i-1
print(N-t-(t % 2 == 1))

Submission status: Accepted

Solution code:
from collections import Counter
import math
N = int(input())
A = Counter(map(int, input().split()))
work = []
for key, val in A.items():
    while val > 2:
        val -= 2
    work.append(val)
len_work = len(work)
two_cnt = work.count(2)
if two_cnt % 2 == 0:
    print(len_work)
else:
    print(len_work - 1)

Submission status: Accepted

Solution code:
n = int(input())
a = sorted(list(map(int, input().split())))
ans, count, val = 0, 1, 0

for i in range(len(a)-1):
    if a[i] == a[i+1]:
        count += 1
    else:
        ans += 1
        val += count-1
        count = 1
val += count-1
ans += 1

if val%2 != 0:
    ans -= 1
print(ans)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    B = len(set(A))
    print(B - (N - B) % 2)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int, input().split()))
cnt=[0]*(max(a)+1)
for i in range(n):
  cnt[a[i]]+=1
odd=0
even=0
for i in range((max(a)+1)):
  if cnt[i]>0:
    if cnt[i]%2==1:
      odd+=1
    else:
      even+=1
if even%2==1:
  print(odd+even-1)
else:
  print(odd+even)

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))

# A.sort()
ans=0 ; kojin=0
# new=[]
from collections import Counter
C=Counter(A)
for i,j in C.items():
    if j>=2:
        if j%2==1:kojin+=1
        else: ans+=1
    else:
        kojin+=1
#print(ans,kojin)
#print(sorted(A))
if ans%2==1:
    ans-=1
print(ans+kojin)

Submission status: Accepted

Solution code:
import sys, math
from functools import lru_cache
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    N = ii()
    A = list(mi())
    print(len(set(A))-1+len(set(A))%2)



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
from collections import Counter
A=list(Counter(A).values())
ans=A.count(1)
l=[i-1 for i in A if i>1]
print(ans+len(l)) if sum(l)%2==0 else print(ans+len(l)-1)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))

from collections import Counter
ac = Counter(A)

td = dict()
for k, v in ac.items():
    if v % 2 == 0:
        td[k] = 2
    else:
        td[k] = 1

ans = 0
two = 0
for k, v in td.items():
    if v == 1:
        ans += 1
    else:
        two += 1

if two % 2 == 0:
    ans += two
else:
    two -= 1
    ans += two

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = map(int,input().split())
s = len(set(a))
if s%2 == 0:
  print(s-1)
else:
  print(s)

Submission status: Accepted

Solution code:
import sys,math,collections,itertools
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))
Ac = collections.Counter(A)
Acl = len(Ac.keys())
if Acl%2 == 0:
    Acl -=1
print(Acl)

Submission status: Accepted

Solution code:
def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    a = list(map(int, input().split()))
    from collections import Counter as cc
    a = cc(a)
    ans = len(a)
    flag = 0
    for x in a:
        if a[x]%2 == 0:
            flag ^= 1
    print(ans-flag)
                
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))

T={}
for a in A:
    if a in T:
        T[a]+=1
    else:
        T[a]=1

U=0
for a in T:
    U+=T[a]-1
U=((U+1)//2)*2
print(N-U)

Submission status: Accepted

Solution code:
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)

"""
3枚以上はそのカードだけで1枚または2枚まで減らせる
偶数なら2枚、奇数なら1枚になる
2枚のカードは他の2枚のカードと組み合わせて1枚のカードになる
もし2枚カードが最後1つになった場合は1枚カードは増えず2枚カードを消す
"""
single = 0
pair = 0

for k,v in c.items():
    if v%2==0:
        pair+=1
    else:
        single+=1

print(single+pair-pair%2)

Submission status: Accepted

Solution code:
N = int(input())
As = list(map(int, input().split()))

S = set([])
lst = []

for a in As:
  if a not in S:
    S.add(a)
  else:
    lst.append(a)
    
if len(lst) % 2 == 0:
  print(len(S))
else:
  print(len(S)-1)

Submission status: Accepted

Solution code:
_,a=open(0);b=len(set(a.split()));print(b+b%2-1)

Submission status: Accepted

Solution code:
n,*a=map(int,open(0).read().split())
b=len(set(a))
print(b-(n-b)%2)

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    A = LI()

    cnt = collections.Counter(A)
    # 同じ数字3枚引いて1, 2枚になるまで減らす
    for i in cnt.keys():
        if cnt[i] % 2 == 0:
            cnt[i] = 2
        else:
            cnt[i] = 1

    ans = 0
    even_num = [i for i in cnt.keys() if cnt[i] == 2]
    # 2枚ある2種類の数字から3枚引けば1枚ずつにできる
    if len(even_num) % 2 == 0:
        ans = len(cnt)
    else:
        # 2枚ある数字が1種類残ったらそれらと別の数字を引く
        ans = len(cnt) - 1

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    A = LI()

    cnt = collections.Counter(A)
    # print(cnt)
    # 同じ数字3枚引いて1, 2枚になるまで減らす
    for i in cnt.keys():
        if cnt[i] % 2 == 0:
            cnt[i] = 2
        else:
            cnt[i] = 1

    ans = 0
    even_num = [i for i in cnt.keys() if cnt[i] == 2]
    # 2枚の数字の種類が3以上の奇数ならば、1種類まで減らせる
    # 2枚の数字の種類が4以上の偶数ならば、0種類まで減らせる(残り4種類は互い違いに食べる)
    if len(even_num) % 2 == 0:
        ans = len(cnt)
    else:
        ans = len(cnt) - 1

    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
d=set()
c=0
for i in a:
  if i in d:
    c+=1
  else:
    d.add(i)

if c%2:
  c+=1
print(n-c)

Submission status: Accepted

Solution code:
from collections import defaultdict

n = int(input())
a = list(map(int,input().split()))

d = defaultdict(int)
for ai in a:
    d[ai] += 1

ans = 0
pair = 0
for k,v in d.items():
    if(v==0):
        continue
    if(v%2==1):
        ans += 1
    else:
        pair += 1

ans += 2*(pair//2)
print(ans)

Submission status: Accepted

Solution code:
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = Counter(LIST())
ans = len(a) if len(a) % 2 == 1 else len(a) - 1
print(ans)

Submission status: Accepted

Solution code:
from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = Counter(LIST())

tmp = 0
f = False
for x in a:
  while a[x] > 1:
    if a[x] == 2:
      a[x] -= 1
      if f:
        f = False
      else:
        tmp += 1
        f = True
    else:
      a[x] -= 2
      tmp += 1
ans = n - tmp*2      
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 22 03:46:03 2020

@author: Dell
"""

n=int(input())
m=list(map(int,input().split()))
from collections import Counter
d=Counter(m)
p=0
l=0
for i in d:
    p+=1
    if d[i]%2==0:
        l+=1
if l%2==0:
    print(p)
else:
    print(p-1)

Submission status: Accepted

Solution code:
import sys
from collections import Counter

input = sys.stdin.readline


def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    c = Counter(A)
    M = len(c)
    if M % 2 == 1:
        ans = M
    else:
        ans = M - 1
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys
from collections import Counter

input = sys.stdin.readline


def main():
    N = int(input())
    A = tuple(map(int, input().split()))

    c = Counter(A)
    M = len(c)
    n_even_v = 0
    for v in c.values():
        if v % 2 == 0:
            n_even_v += 1
    
    if n_even_v % 2 == 0:
        ans = M
    else:
        ans = M - 1
    print(ans)


if __name__ == "__main__":
    main()