#C10202. Running Records

    ID: 39382 Type: Default 1000ms 256MiB

Running Records

Running Records

John keeps track of his running times for each kilometer he runs. Every time he runs a kilometer, he records the time, and he is interested in knowing how many times he improves his records. He considers his fastest kilometer record as the one with the smallest time, and his slowest kilometer record as the one with the largest time. Whenever he runs a kilometer, if the time is strictly less than his best (i.e., fastest) time so far, he breaks his fastest record; similarly, if the time is strictly greater than his worst (i.e., slowest) time so far, he breaks his slowest record.

Formally, if the list of times is given by \(t_1, t_2, \dots, t_n\), then for each \(i\) from 2 to \(n\):

\(\text{if } t_i < \min\{t_1, t_2, \dots, t_{i-1}\} \) then the fastest record is broken; and
\(\text{if } t_i > \max\{t_1, t_2, \dots, t_{i-1}\} \) then the slowest record is broken.

Your task is to compute the number of times John breaks his fastest and slowest records.

inputFormat

The input consists of two lines:

  • The first line contains an integer \(n\) representing the number of kilometers.
  • The second line contains \(n\) space-separated integers, where each integer represents the time (in minutes) taken to run that kilometer.

You may assume \(n \ge 1\).

outputFormat

Output two space-separated integers on a single line. The first integer is the number of times John breaks his fastest record, and the second integer is the number of times he breaks his slowest record.

## sample
4
5 5 5 5
0 0