Solution:
Answer 1989
Since ∣a−b∣≤max(a,b), a trivial induction shows that the expression does not exceed max(a1,a2,…,a1990)=1990. But for integers, ∣a−b∣ has the same parity as a+b, so a trivial induction shows that the expression has the same parity as a1+a2+…+a1990=1990⋅1991/2, which is odd. So it cannot exceed 1989. That can be attained by the permutation 2,4,5,3,6,8,9,7,…,4k+2,4k+4,4k+5,4k+3,…,1984+2,1984+4,1984+5,1984+3,1990,1. Because we get successively 2,3,0;6,2,7,0;10,2,11,0;…;4k+2,2,4k+3,0;…;1986,2,1987,0;1990,1989.