TouchStone
  Please Login
Login Sign Up
 Homepage  Problem Set  Examinations  Submissions  Discussions  Statistics
  • Home
  • Problem Set
  • P6486
  • Problem
  • P6486吞食卡牌
    Limits : Time Limit : - MS   Memory Limit : - KB
    Judgment Tips : 1s 256MB
    Description

    果老师有$N$张卡牌,第$i$张卡牌写着数字$A_i$,果老师接下来会执行以下操作任意次,使得操作结束之后牌没有相同的:

    • 从剩余的卡牌中挑选出三张,然后舍弃掉这三张中数值最大和数值最小的

    果老师想知道在执行完操作之后,剩余卡片的数量最大为多少?

    Input Format

    输入包含两行。

    第一行为一个正整数$N(3 \leq N \leq 10^5)$,$N$为奇数。

    第二行为$N$个正整数$A_i(1 \leq A_i \leq 10^5)$,即每张卡片上的数值。

    Output Format

    打印一个正整数,表示操作结束之后剩余最多的卡片数量。

    Sample Input 1

    5
    1 2 1 3 7

    Sample Output 1

    3

    Sample Input 2

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

    Sample Output 2

    7