typedef long long ll; typedef long double ld; #include using namespace std; #define int long long signed main(){ ll n; std::cin >> n; vector a(n),b(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; b[i] = a[i]; if(i%2==1){ b[i] = !b[i]; } } vector zi,oi; for (int i = 0; i < n; i++) { if(b[i]){ oi.push_back(i); }else{ zi.push_back(i); } // std::cout << b[i]<<" "; } // std::cout << std::endl; ll ans = 0; for (int i = 0; i < n; i++) { if(a[i]==1){ auto &c = (b[i]? zi : oi); // std::cout << "c: "<