import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int read() { return readln.chomp.to!int; }
int[] reads() { return readln.split.to!(int[]); }

void main() {
    int n = read();
    int[] a = reads();
    int ans = -114514810;
    foreach (i; 0..n) foreach (j; 0..n) {
        if (i == j) continue;
        ans = max(ans, abs(a[i] - a[j]));
    }
    writeln(ans);
}