def task_8_18():
    i = 0
    while wall_is_beneath():
        if not wall_is_above():
            move_up()
            while True:
                if not cell_is_filled():
                    fill_cell()
                else:
                    i += 1
                if wall_is_above():
                    break
                move_up()
            while not wall_is_beneath():
                move_down()
        else:
            fill_cell()
        move_right()
    mov('ax', i)