#K61477. Largest Temperature Difference

    ID: 31318 Type: Default 1000ms 256MiB

Largest Temperature Difference

Largest Temperature Difference

You are given a series of temperature readings recorded hourly. Your task is to determine the largest temperature difference that occurred during any continuous period. In other words, you need to compute the difference between the maximum and minimum temperatures recorded. The temperature readings are provided as integers and the solution should compute the value max - min for the given set of readings.

The mathematical formulation is as follows:

\[ \text{Answer} = \max_{1 \leq i \leq n} (T_i) - \min_{1 \leq i \leq n} (T_i)\]

inputFormat

The input is given via standard input and consists of two lines:

  1. The first line contains an integer n representing the number of temperature readings.
  2. The second line contains n space-separated integers, each representing a temperature reading.

outputFormat

Output a single integer to the standard output representing the largest difference between any two recorded temperatures.

## sample
5
-10 0 10 20 30
40

</p>