Is there function $f(s)$ to measure "chaosity" of a sequence $s$? For example, sequence $s_1=1,2,3,4,5$ is ordered so $f(s_1)$ equals zero and $s_2 = 3,1,2,5,4$ is not actually ordered but less ordered than $s_3=1,2,3,5,4$, so $f(s_2) > f(s_3)$.
Is there function $g(s)$ to measure decreasing order, so $g(s) = 0$ for $s=1,2,3,4,5$, $g(s) = 1$ for $s=5,4,3,2,1$ and $0
Any comments are appreciated.