eolymp
bolt
Try our new interface for solving problems

Chain

Dana chain consisting of \textbf{k = 4n} units. Moreover \textbf{2n} gold and \textbf{2n} links - silver. Two robbers want to rightly divide the silver and gold of the chain. Make a program that finds the minimum number of sections of the chain, such that both silver and gold could be divided between two thieves. \InputFile The program reads the first number of links \textbf{k}, and then - \textbf{k} the numbers \textbf{0} or \textbf{1} (\textbf{0} - a silver link, \textbf{1} - gold). All numbers are entered on one line through the gaps. \OutputFile The program displays a single number - the minimum number of cuts and the number of links between them made cuts. The first section must be as close as possible to the beginning of the chain. \textbf{N < 10000}.
Time limit 1 second
Memory limit 64 MiB
Input example #1
8 0 1 0 0 1 1 0 1
Output example #1
2 1 2 5 6
Source II этап Всеукраинской олимпиады школьников 2008-2009, г. Бердичев