#include int main(){ int n,m,a[10000],s; scanf("%d",&n);m=s=n; while(s)scanf("%d",a+n-s--); while(n--)for(s=0;s++-n;)a[s-1]>a[s]&&(a[s-1]^=a[s]^=a[s-1]^=a[s]); while(--m)if(s=a[m]-a[m-1])n=!~n||s