#include using namespace std; int main(){ int n; cin >> n; vector a(n); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } sort(a.begin(), a.end()); long res = LONG_MAX, d; for(int i = 0; i < n - 1; i++) { d = a[i + 1] - a[i]; if (d < res) res = d; } cout << res; return 0; }