#include #include using namespace std; int main() { int N, X[100000]; int answer = 1000001; cin >> N; for(int i = 0; i < N; ++i) { cin >> X[i]; } sort(X, X + N); for(int i = 1; i < N; ++i) { if(X[i] != X[i - 1]) { if(answer > (X[i] - X[i - 1])) { answer = (X[i] - X[i - 1]); } } } if(answer == 1000001) { answer = 0; } cout << answer << endl; return 0; }