func_code_string: #include <bits/stdc++.h>   using namespace std;   long long int arr[100001], done[100001], cnt0[100001], cnte[100001],       cnto[100001];   long long int dp[105][105][2];   int main() {     ios::sync_with_stdio(false);     ;     cin.tie(0);     ;     long long int i, j, n, k, l, x, y, evenLeft = 0, oddLeft = 0, z;     cin >> n;     for (i = 1; i <= n; i++) {       cin >> arr[i];       if (arr[i] != 0) done[arr[i]] = 1;     }     oddLeft = 0;     evenLeft = 0;     for (i = 1; i <= n; i++) {       if (done[i]) continue;       if (i & 1)         oddLeft++;       else         evenLeft++;     }     for (i = 1; i <= n; i++) cnt0[i] = cnt0[i - 1] + (arr[i] == 0);     for (i = 1; i <= n; i++) {       cnte[i] = cnte[i - 1];       if (arr[i] != 0 && arr[i] % 2 == 0) cnte[i]++;     }     for (i = 1; i <= n; i++) {       cnto[i] = cnto[i - 1];       if (arr[i] != 0 && arr[i] & 1) cnto[i]++;     }     for (i = 0; i <= n; i++) {       for (j = 0; j <= n; j++) {         for (k = 0; k <= 1; k++) dp[i][j][k] = 1000000000000;       }     }     if (arr[1] != 0) {       if (arr[1] & 1)         dp[1][evenLeft][1] = 0;       else         dp[1][evenLeft][0] = 0;     } else {       if (evenLeft > 0) dp[1][evenLeft - 1][0] = 0;       if (oddLeft > 0) dp[1][evenLeft][1] = 0;     }     for (i = 1; i < n; i++) {       for (j = 0; j <= evenLeft; j++) {         for (k = 0; k <= 1; k++) {           if (dp[i][j][k] == 1000000000000) continue;           x = cnt0[i];           y = evenLeft - j;           z = oddLeft - (x - y);           if (arr[i + 1] != 0) {             if (arr[i + 1] % 2 == k)               dp[i + 1][j][arr[i + 1] % 2] =                   min(dp[i + 1][j][arr[i + 1] % 2], dp[i][j][k]);             else               dp[i + 1][j][arr[i + 1] % 2] =                   min(dp[i + 1][j][arr[i + 1] % 2], dp[i][j][k] + 1);           } else {             if (j > 0) {               if (k == 0)                 dp[i + 1][j - 1][0] = min(dp[i + 1][j - 1][0], dp[i][j][k]);               else                 dp[i + 1][j - 1][0] = min(dp[i + 1][j - 1][0], dp[i][j][k] + 1);             }             if (z > 0) {               if (k == 0)                 dp[i + 1][j][1] = min(dp[i + 1][j][1], dp[i][j][k] + 1);               else                 dp[i + 1][j][1] = min(dp[i + 1][j][1], dp[i][j][k]);             }           }         }       }     }     cout << min(dp[n][0][0], dp[n][0][1]);     return 0;   }   