P27189 [AtCoder] Card Game
提高-
题目描述

Problem Description

There is a card game for two players as follows:

  • In this game, we use a total of $2n$ cards, each marked with an integer from $1$ to $2n$. Here, $n$ is an integer between $1$ and $100$.
  • These cards are distributed equally, $n$ cards each, to the two players.
  • Players take turns placing one card on the table according to the following rules:
  • If there are no cards on the table, any card can be placed.
  • If there are cards on the table, a card with a number greater than the last card placed on the table can be placed. If a player can place a card, they must do so.
  • If a player cannot place a card, they pass, and it becomes the opponent's turn. At this point, the cards on the table are removed.
  • The game starts with no cards on the table.
  • The game ends when one player runs out of cards.
  • The score at the end of the game is the number of cards the opponent has left.

Taro and Hanako will play this game. The game starts with Taro's turn. Both players will always place the card with the smallest number that they can legally place.

Given the cards distributed to Taro, create a program that outputs the scores of Taro and Hanako.


Input Format

The input consists of $n + 1$ lines. The first line contains the integer $n$. From the second line to the $n + 1$th line, each line contains one integer representing the numbers on the cards distributed to Taro.

Output Format

The output consists of 2 lines. The first line should contain Taro's score, and the second line should contain Hanako's score.


Sample Input and Output

Sample Input #1

5
1
7
9
6
10

Sample Output #1

3
0

Sample Input #2

10
8
7
14
18
4
11
3
17
5
19

Sample Output #2

2
0

Notes/Hints

Sample Explanation 1

- - - - - -

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 1 7 9 6 10
样例输出
3 0