P3078 [USACO13MAR] Poker Hands S

Description

Bessie and her friends are playing a unique version of poker involving a deck with N (1

Input Format

\* Line 1: The integer N. \* Lines 2..1+N: Line i+1 contains the value of a\_i.

Output Format

\* Line 1: The minimum number of straights Bessie must play to get rid of all her cards.

Explanation/Hint

Bessie can play a straight from 1 to 5, a straight from 1 to 2, a straight from 4 to 5, two straights from 2 to 2, and a straight from 5 to 5, for a total of 6 rounds necessary to get rid of all her cards.