#include using namespace std; int main(){ int n; cin >> n; vector a(n), absDiffs(n-1,0); for(int a_i = 0; a_i < n; a_i++){ cin >> a[a_i]; } // sort the vector in ascending order sort(a.begin(),a.end()); //populate an array of min absolute differences involving each number, then determine the minimum for(int i=0;i!=n-1;i++){ if(i==0) absDiffs[i]=a[i+1]-a[i]; else absDiffs[i]=min(abs(a[i]-a[i-1]),abs(a[i+1]-a[i])); } cout<<*min_element(absDiffs.begin(),absDiffs.end()); return 0; }