#include #include int main(void){ int n; std::cin >> n; std::vector A(n); int last = -1; int count = 0; std::vector tunagari; for(int i=0; i> A[i]; if(i){ if(last != A[i]){ tunagari.push_back(count); count = 0; } } last = A[i]; count++; } if(count) tunagari.push_back(count); if(tunagari.size()%2) tunagari.push_back(0); std::vector dp(tunagari.size()+2); for(int i=tunagari.size()-1; i>=0; i--){ int a = dp[i+2] + tunagari[i]; int b = dp[i+1]; dp[i] = a