Counting ranges as a replacement for range