from numpy import diff def main(): N = int(input()) X = list(map(int, input().split())) X.sort() X_diff = diff(X) X_diff_positive = list(filter(lambda num: num > 0, X_diff)) if not X_diff_positive: print(-1) else: print(min(X_diff_positive)) if __name__ == "__main__": main()