title: How to count the duplicated numbers of list with order
body: <p>I'm wondering what is the efficient way to count the duplicate numbers of list.</p>
  <p>This is the example:</p>
  <p>numbers = [5, 10,10,10, 15,15, 8,8,8,8]</p>
  <p>answer = <strong>[1,3,2,4]</strong></p>
  <p>.</p>
  <p>This is my code that I figured out... but seems inefficient.</p>
  <pre><code>answer=[]
  now = numbers[0]
  count=1
  done=False
  for n in numbers[1:]:
      if now == n:
          count+=1
          done=False
      else:
          answer.append(count)
          count=1
          now=n
          done=True
  if(not done):
      answer.append(count)
  if(done):
      answer.append(1)
  return answer
  </code></pre>
  <p>Does anyone have good answer for this?</p>