Check whether array A is a permutation.