Condition if ref size is zero or bit is negative then return 0
if ( re . Count == 0 bit < 0 ) return 0 ; List < int > curr_on = new List < int > ( ) ; List < int > curr_off = new List < int > ( ) ; for ( int i = 0 ; i < re . Count ; i ++ ) {