P2995 [USACO10NOV] Cow Photographs G

Description

Farmer John wants to take a picture of his entire herd of N (1

Input Format

\* Line 1: A single integer: N \* Lines 2..N+1: Line i+1 contains the number of the i-th cow in line: c\_i

Output Format

\* Line 1: The minimum amount of time, in minutes, that it takes Farmer John to get the cows into some appropriate order.