Sequential Nim

In Sequential Nim, players must take stones from piles in order. They start with pile 0, and a move consists of removing any positive number of stones from the current pile. When a pile becomes empty, play moves to the next non-empty pile to the right. The player who takes the last stone wins. Determine which player wins: return 1 if the first player wins, 2 if the second player wins.

Examples
Input: [1,1]
Output: 2
Hints

Sequential Nim

In Sequential Nim, players must take stones from piles **in order**. They start with pile 0, and a move consists of removing any positive number of stones from the current pile. When a pile becomes empty, play moves to the next non-empty pile to the right. The player who takes the last stone wins. Determine which player wins: return 1 if the first player wins, 2 if the second player wins.