Problem :

https://www.hackerrank.com/challenges/jumping-on-the-clouds/problem


My Solution :

#!/usr/bin/env python3


def jumping_on_clouds(c):
    count = i = 0
    while i < len(c)-1:
        count += 1
        if i+2 < len(c) and c[i+2]:
            i += 1
        else:
            i += 2
    return count


n = int(input())
c = list(map(int, input().rstrip().split()))
result = jumping_on_clouds(c)
print(result)