import std.stdio, std.conv, std.math, std.string, std.range, std.array, std.algorithm; void main(){ readln(); auto t = readln().strip().split().map!(to!int)().array().sort().uniq().array(); auto u = t.dup[1..$]; auto v = t[0..$-1]; if(u.empty) { writeln("0"); return; } u[] -= v[]; u.reduce!min().writeln(); }