Problem:
Score : 200 points

Problem Statement

You are given an integer sequence A of length N.
Find the maximum absolute difference of two elements (with different indices) in A.

Constraints

2 \leq N \leq 100

1 \leq A_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 ... A_N

Output

Print the maximum absolute difference of two elements (with different indices) in A.

Sample Input 1

4
1 4 6 3

Sample Output 1

5

The maximum absolute difference of two elements is A_3-A_1=6-1=5.

Sample Input 2

2
1000000000 1

Sample Output 2

999999999

Sample Input 3

5
1 1 1 1 1

Sample Output 3

0

Solution in Rust (1.15.1) (judge verdict: Accepted)

#![allow(unused_imports)]
#![allow(dead_code)]
use std::io::{stdin, stdout, stderr, Write, BufWriter, BufReader, BufRead};

macro_rules! read_from_line {
    ($inbuf:ident => $($name:ident : $ty:ty),* ) => {
        let mut buf = String::new();
        $inbuf.read_line(&mut buf).unwrap();
        buf.pop();
        let mut words = buf.split_whitespace();
        $(
            let $name:$ty = words.next().unwrap().parse().unwrap();
        )*
    };
}

macro_rules! read_many {
    ($inbuf:ident => $name:ident : $ty:ty) => {
        let $name: Vec<$ty> = strio::read_many_from_line(&mut $inbuf);
    };
}

fn main() {
    let cout = stdout();
    let mut cout = BufWriter::new(cout.lock());
    let cin = stdin();
    let mut cin = BufReader::new(cin.lock());

    //read_from_line!(cin => a:i32, b:String);
    //let xs: Vec<i32> = strio::read_many_from_line(&mut cin);
    
    read_from_line!(cin => _n:i32);
    read_many!(cin => xs:i64);

    writeln!(cout, "{}", xs.iter().max().unwrap() - xs.iter().min().unwrap()).unwrap();


}

mod strio {
    use std::str::FromStr;
    use std;

    pub fn read_from_line<T, R> (r: &mut R) -> T where
        T: FromStr,
        <T as std::str::FromStr>::Err : std::fmt::Debug,
        R: std::io::BufRead,
    {
        let mut buf = String::new();
        r.read_line(&mut buf).unwrap();
        buf.pop();
        buf.parse().unwrap()
    }

    pub fn read_many_from_line<T, R> (r: &mut R) -> Vec<T> where
        T: FromStr,
        <T as std::str::FromStr>::Err : std::fmt::Debug,
        R: std::io::BufRead,
    {
        let mut buf = String::new();
        r.read_line(&mut buf).unwrap();
        buf.pop();
        buf.split_whitespace().map(|x| x.parse().unwrap()).collect()
    }
}