import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.datetime;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;
    auto M = A.reduce!min;

    int last = - (1 << 29);
    int ans = 1 << 29;
    foreach (i; 0..N) {
        if (A[i] == M) {
            ans = min(ans, i - last);
            last = i;
        }
    }

    ans.writeln;
}
