func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 110;   int a[maxn];   int main() {     int n;     while (cin >> n) {       int ans = 0;       for (int i = 1; i <= n; i++) {         cin >> a[i];         if (a[i]) ans++;       }       for (int i = 1; i <= n; i++) {         if (a[i] == 1) {           if (i == 1) continue;           if (a[i - 1] && i >= 1) continue;           if (i >= 2 && a[i - 2]) {             ans++;             continue;           }         }       }       cout << ans << endl;     }   }   