Try this formula, entered as an array (CNTRL SHFT + ENTER)

=MAX(FREQUENCY(IF(B2:AM2="N",COLUMN(B2:AM2)-1),IF(B2:AM2<>"N",COLUMN(B2:AM2)-1)))
Does that work for you?