public static int missingItem(int[]A) {
		int n=A.length;
		int[]gaps=new int[n-1],rec=new int[2], c=new int[2];
		for (int i=0;i<n-1;++i){
			gaps[i]=A[i+1]-A[i];
			if (c[0]==0) {rec[0]=gaps[i];++c[0];}
			else {
				if (rec[0]==gaps[i]) ++c[0];
				else {
					if (c[1]==0) {rec[1]=gaps[i];++c[1];}
					else ++c[1];
				}
			}
		}
		int gap,inc;
		if (c[0]<c[1]) {gap=rec[0];inc=rec[1];}
		else {gap=rec[1];inc=rec[0];}
		for (int i=0;i<n-1;++i)
			if (gaps[i]==gap) return A[i]+inc;
		return -1;
	}