oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

noodles Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

noodles.html

Problem Description

Peanut does not like to go out very much, and is too lazy to cook, so he has kept a stock of N packets of instant noodles at home.

Each instant noodle pack i expires on day Di, which means Peanut must eat it on or before that day.

On each day, starting from day 1, Peanut can either eat one pack, or not eat any. Determine what is the maximum number of packets Peanut can finish.

Limits

Subtask 1 (36%): 1 ≤ N ≤ 1000, 1 ≤ Di ≤ 1000.

Subtask 2 (21%): 1 ≤ N ≤ 1000, 1 ≤ Di ≤ 109.

Subtask 3 (43%): 1 ≤ N ≤ 200000, 1 ≤ Di ≤ 109.

Subtask 4 (0%): Sample Testcases.

Input

The first line of input contains one integer, N.

The second line of input contains N integers, representing the array D.

Output

The only line of output should contain one integer, the maximum number of noodles Peanut can eat.

Sample Testcase 1

Input

5
1 2 3 3 6

Output

4

Sample Testcase 2

Input

7
1 2 2 4 4 8 4

Output

5

Tags

Greedy

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
136220.5s256MBMinimum
221420.5s256MBMinimum
343620.5s256MBMinimum
4020.5s256MBMinimum

Judge Compile Command

g++-8 ans.cpp -o noodles -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.