欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1195A.Drinks Choosing
Drinks Choosing
Old timers of Summer Informatics School can remember previous camps in which each student was given a drink of his choice on the vechorka (late-evening meal). Or may be the story was more complicated?
There are students living in a building, and for each of them the favorite drink is known. So you know integers , where () is the type of the favorite drink of the -th student. The drink types are numbered from to .
There are infinite number of drink sets. Each set consists of exactly two portions of the same drink. In other words, there are types of drink sets, the -th type contains two portions of the drink . The available number of sets of each of the types is infinite.
You know that students will receive the minimum possible number of sets to give all students exactly one drink. Obviously, the number of sets will be exactly , where is rounded up.
After students receive the sets, they will distribute their portions by their choice: each student will get exactly one portion. Note, that if is odd then one portion will remain unused and the students' teacher will drink it.
What is the maximum number of students that can get their favorite drink if sets will be chosen optimally and students will distribute portions between themselves optimally?
Input
The first line of the input contains two integers and () — the number of students in the building and the number of different drinks.
The next lines contain student's favorite drinks. The -th line contains a single integer from to — the type of the favorite drink of the -th student.
Output
Print exactly one integer — the maximum number of students that can get a favorite drink.
Note
In the first example, students could choose three sets with drinks , and (so they will have two sets with two drinks of the type each and one set with two drinks of the type , so portions will be ). This way all students except the second one will get their favorite drinks.
Another possible answer is sets with drinks , and . In this case the portions will be . Then all the students except one will gain their favorite drinks. The only student that will not gain the favorite drink will be a student with (i.e. the first, the third or the fourth).
Samples
5 3
1
3
1
1
2
4
10 3
2
1
3
2
3
3
1
3
1
2
9
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |