import std.stdio, std.string, std.conv, std.algorithm, std.numeric; import std.range, std.array, std.math, std.typecons, std.container, core.bitop; import std.functional; void main() { int n = readln.chomp.to!int; readln; iota(n).map!(i => readln.chomp.to!int).array.fold!(min, max)(1000, 0).unaryFun!"a[1] - a[0]".writeln; }