a cinema n row seat number 1 n seat row label 1 10 show figure aboveGiven array reservedseat contain number seat reserve example reservedseatsi 38 mean seat locate row 3 label 8 reservedreturn maximum number fourperson group assign cinema seat a fourperson group occupy adjacent seat single row Seats aisle 33 34 consider adjacent exceptional case aisle split fourperson group case aisle split fourperson group middle mean people Example 1input n 3 reservedseat 1213182631310output 4explanation the figure show optimal allocation group seat mark blue reserve contiguous seat mark orange groupExample 2input n 2 reservedseat 211826output 2example 3input n 4 reservedseat 43144617output 4 Constraints1 n 1091 reservedseatslength min10n 104reservedseatsilength 21 reservedseatsi0 n1 reservedseatsi1 10all reservedSeatsi distinct