Consider the following variant of Nim:

There are two players and $n$ piles of stones, with sizes $a_1,\dots,a_n$, such that $a_i\leq a_j$ for any $i<j$.

A move consists of removing a positive number of stones from any pile, such that inequalities are preserved.

A player loses if all piles are empty.

What are the winning positions, or, more generally, what is the Sprague-Grundy value of a position?