Consider a vector which goes in ascending order from (1, 2, 3 ... N). This vector is ordered 'correctly' and I would like to assign it a score of 1, which indicates a perfectly ascending ordered vector. 

On the other hand, a vector (N, N-1, N-2 ... 3, 2, 1) has the 'worst' possible score of 0. 

In between 0 and 1, the vector can be 'scrambled' and I would like a way to calculate how 'ordered' it is compared to the perfect case of (1, 2, 3 ... N). 

Does anyone know of a way to calculate such a score which measures the ordered-ness of a vector?