#include <stdio.h>
#include <stdlib.h>

int NextInt() { int d; scanf("%d", &d); return d; }


int comp(const void* a, const void* b) {
  if (*(int*)a > *(int*)b) {
    return 1;
  }
  return 0;
}

int main() {
  int i, n;
  int a[10001];
  int min = 10000001;

  while (1) {
    n = NextInt();
    if (n == 0) {
      break;
    }
    for (i = 0; i < n; i++) {
      a[i] = NextInt();
    }    
    qsort(a, n, sizeof(a[0]), comp);
    for (i = 1; i < n; i++) {
      if (a[i] - a[i - 1] < min) {
        min = a[i] - a[i - 1];
      }
    }
    printf("%d\n", min);
  }
  return 0;
}