fork download
  1. n = int(input())
  2. a = list(map(int, input().split()))
  3.  
  4. for i in range(1, n-1):
  5. if a[i-1] == 1 and a[i] == 0 and a[i+1] == 1:
  6. a[i] = 1
  7. wynik = a.count(1)
  8. print(wynik)# your code goes here
Success #stdin #stdout 0.07s 14128KB
stdin
1
0
stdout
0