문제
A terrible new disease, COWVID-19, has begun to spread among cows worldwide.
Farmer John is trying to take as many precautions as possible to protect his herd from infection.
Farmer John's barn is a long narrow building containing
Farmer John wants to maximize
Two new cows recently joined Farmer John's herd and he needs to decide to which formerly-unoccupied stalls they should be assigned. Please determine how he can place his two new cows so that the resulting value of
SAMPLE INPUT:
14
10001001000010SAMPLE OUTPUT:
2In this example, Farmer John could add cows to make the occupancy string look like 10x010010x0010, where x's indicate the new cows. In this case
SCORING:
Test cases 2-6 satisfy
N\le 10 .Test cases 7-8 satisfy
N\le 100 .Test cases 9-11 satisfy
N \le 5000 .Test cases 12-15 satisfy no additional constraints.
Problem credits: Brian Dean
입력
The first line of input contains
출력
Please print the largest value of
that Farmer John can achieve after adding his two new cows in an optimal fashion.