Pear Trees and Apple Trees

No attempts yetTime limit1sMemory limit128 MB

Problem

In an orchard, pear trees and apple trees are all planted along a straight line, each spaced 11 meter apart from the next. The orchard's owner, Mr. Wiktor, wants to find the pear tree that is farthest from any apple tree. Help him by computing the maximum distance between a pear tree and an apple tree.

Input

The first line contains an integer nn (2n1062 \le n \le 10^6), the number of trees in the orchard. The second line contains nn integers a1,a2,,ana_1, a_2, \dots, a_n separated by spaces. Each aia_i gives the type of the ii-th tree: 00 means a pear tree and 11 means an apple tree. You may assume the orchard contains at least one pear tree and at least one apple tree.

Output

Print a single integer: the maximum distance between a pear tree and an apple tree. Because adjacent trees are 11 meter apart, the distance between the ii-th and jj-th trees is ij|i - j| meters.