Selection of Participants of an Experiment (AOJ 1608) by ynu_a
Contest: 3394    RunID: 2247634    Status: Accepted    Date: Sun Apr 09 14:57:23 JST 2017


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cassert>
#include<cstring>
#include<climits>
#include<sstream>
#include<deque>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<bitset>

#define REP(i,s,n) for(int i=s;i<n;++i)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef long long ll;

int a[1001]={0};

int main() {
  int n;
  while(scanf("%d",&n),n!=0){
    for(int i=0;i<n;++i){
      scanf("%d ",&a[i]);
    }
    int minimum = INT_MAX;
    for(int i=0;i<n;++i){
      for(int j=i+1;j<n;++j){
        if(abs(a[i] - a[j]) < minimum)minimum = abs(a[i] - a[j]);
      }
    }
    printf("%d\n",minimum);
  }

  return 0;
}