Add length counting to IndexQueue.