#include void solve() { int n; std::cin >> n; int px = -1; int odp = 0, xdp = 0; while (n--) { int x; std::cin >> x; int nodp = xdp + 1; if (px == x) nodp = std::max(nodp, odp + 1); int nxdp = std::max(xdp, odp); px = x; odp = nodp; xdp = nxdp; } std::cout << std::max(odp, xdp) << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }