#include #include #include using namespace std; int main(){ int n; scanf("%d", &n); set s; for(int i = 0; i < n; i++){ int num; scanf("%d", &num); s.insert(num); } int before = *s.begin(), ans = 1 << 29; if(s.size() == 0){ ans = 0; } else{ for(auto it = s.begin(); ++it != s.end();){ ans = min(ans, *it - before); before = *it; } } printf("%d\n", ans); return 0; }