#include <bits/stdc++.h>
#define LL long long
using namespace std;
int main()
{
int n;
scanf("%d",&n);
int ganjil=(n+1)/2;
int genap=(n/2);
int arr[n+5];
for(int a=1;a<=n;a++)
{
scanf("%d",&arr[a]);
}
int dp[n+4][ganjil+5][genap+5][2];
for(int a=0;a<=n;a++)
for(int b=0;b<=ganjil;b++)
for(int c=0;c<=genap;c++)
for(int d=0;d<=1;d++)
dp[a][b][c][d]=1e9;
dp[0][0][0][0]=0;
dp[0][0][0][1]=0;
// panjang , sisa ganjil, sisa genap,sebelumnya, sekarang;
for(int a=1;a<=n;a++)
{
for(int b=0;b<=ganjil;b++)
{
for(int c=0;c<=genap;c++)
{
for(int e=0;e<=1;e++)
{
if(b==0 && c==0)
continue;
if(b==0 && e==1)
continue;
if(c==0 && e==0)
continue;
if(arr[a])
{
if(arr[a]%2==1 && e==0)
continue;
if(arr[a]%2==0 && e==1)
continue;
}
if(e==0)// kalau enya genap
{
dp[a][b][c][e]=min(dp[a-1][b][c-1][e],dp[a][b][c][e]);
dp[a][b][c][e]=min(1+dp[a-1][b][c-1][1],dp[a][b][c][e]);
}
if(e==1)// kalau enya ganjil
{
dp[a][b][c][e]=min(dp[a-1][b-1][c][e],dp[a][b][c][e]);
dp[a][b][c][e]=min(1+dp[a-1][b-1][c][0],dp[a][b][c][e]);
}
if(a==1 && dp[a][b][c][e]>=0)
dp[a][b][c][e]=0;
}
}
}
}
// for(int a=0;a<=n;a++)
// for(int b=0;b<=ganjil;b++)
// for(int c=0;c<=genap;c++)
// for(int d=0;d<=1;d++)
// printf("dp[%d][%d][%d][%d]=%d\n",a,b,c,d,dp[a][b][c][d]);
// int maks=-1e9;
if(arr[n])
{
if(arr[n]&1)
printf("%d\n",dp[n][ganjil][genap][1]);
else
printf("%d\n",dp[n][ganjil][genap][0]);
}
else
printf("%d\n",min(dp[n][ganjil][genap][1],dp[n][ganjil][genap][0]));
// printf("%d\n",maks);
}
868A - Bark to Unlock | 873B - Balanced Substring |
1401D - Maximum Distributed Tree | 1716C - Robot in a Hallway |
1688B - Patchouli's Magical Talisman | 99A - Help Far Away Kingdom |
622B - The Time | 1688C - Manipulating History |
1169D - Good Triple | 1675B - Make It Increasing |
588A - Duff and Meat | 1541B - Pleasant Pairs |
1626B - Minor Reduction | 1680A - Minimums and Maximums |
1713A - Traveling Salesman Problem | 1713B - Optimal Reduction |
1710A - Color the Picture | 1686B - Odd Subarrays |
251A - Points on Line | 427C - Checkposts |
1159A - A pile of stones | 508A - Pasha and Pixels |
912A - Tricky Alchemy | 1249A - Yet Another Dividing into Teams |
1713C - Build Permutation | 1699A - The Third Three Number Problem |
1617B - GCD Problem | 841A - Generous Kefa |
1690B - Array Decrements | 1692C - Where's the Bishop |