title: NSMutableArray counting occurrences of objects and then rearrange the array
body: <p>I have been seeking the best way in modifying a NSMutableArray which can hold multiple instances of the same object. I working also for iOS versions under 4.0 so using block is not the way to go.</p>
  
  <p>Here's the situation:</p>
  
  <p>I have an array like this:</p>
  
  <pre><code>ARRAY = [object1,object2,object3,object4,object5,object6,object7,object8];
  </code></pre>
  
  <p>Let's say that object2 object3 and object4 are actually the same objects. And object1 and object 7 as well. Then I would like to rearrange the array so that the most occurrences appear first and so on. So the array would have to look like this:</p>
  
  <p>[object2,object3,object4,object1,object7,object5,object6,object8];</p>