Help me in solving BOUNCE_BALL problem

My issue

Can anyone explain how the answer for this test case is 2
4
1 0 0 2
I want to understand how the number of ways is being considered.

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here

}

Problem Link: Bouncing Ball Practice Coding Problem