#include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; long long MOD = 1000000007; int main() { int ans = INT_MAX; int N; cin >> N; vector X(N); for ( int i = 0; i < N; i++ ) { cin >> X[i]; } sort( X.begin(), X.end() ); for ( int i = 0; i < N-1; i++ ) { if ( X[i] == X[i+1] ) { continue; } int dist = X[i+1] - X[i]; ans = min( ans, dist ); } cout << ans << endl; return 0; }