import algorithm, sequtils, strutils let n = readLine stdin xs = stdin.readLine .split .map(parseInt) .sorted .deduplicate(true) if xs.len < 2: echo 0 quit() var d = xs[1].pred xs[0] for i in 1..xs.high: d = d.min xs[i].pred xs[i.pred] echo d