{"problem":{"name":"Count 1's","description":{"content":"You are given an integer sequence of length $N$ consisting of $0$ and $1$: $A=(A_1,A_2,\\cdots,A_N)$. You will do the operation below exactly once. *   Choose a **contiguous** subsequence of $A$ and f","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc137_b"},"statements":[{"statement_type":"Markdown","content":"You are given an integer sequence of length $N$ consisting of $0$ and $1$: $A=(A_1,A_2,\\cdots,A_N)$.\nYou will do the operation below exactly once.\n\n*   Choose a **contiguous** subsequence of $A$ and flip the elements in it: convert $0$ to $1$ and vice versa. Here, you may choose an empty subsequence, in which case the elements of $A$ do not change.\n\nYour score will be the number of $1$'s in $A$. How many values are there that your score can take?\n\n## Constraints\n\n*   $1 \\leq N \\leq 3 \\times 10^5$\n*   $0 \\leq A_i \\leq 1$\n*   All values in input are integers.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $\\cdots$ $A_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc137_b","tags":[],"sample_group":[["4\n0 1 1 0","4\n\nThere are four possible values for your score: $0, 1, 2, 3$. For example, if you flip the $2$\\-nd through $4$\\-th elements of $A$, you will get $A=(0,0,0,1)$, for a score of $1$."],["5\n0 0 0 0 0","6"],["6\n0 1 0 1 0 1","3"]],"created_at":"2026-03-03 11:01:13"}}