20 heads in a row (improved algorithm)