func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int n, a[100008], cnt = 0;   int main() {     ios_base::sync_with_stdio(0);     cin >> n;     for (int i = 1; i <= n; i++) cin >> a[i];     for (int i = 1; i <= n; i++) {       if (a[i] == 1) {         if (!cnt) cnt++;         int j = i + 1;         while (a[j] != 1 && j <= n) j++;         if (a[j] == 1) {           cnt += min(j - i, 2);           i = j - 1;         }       }     }     cout << cnt << endl;   }   