title: Function to find minimum number of survivors
body: <p>Given are different types of cells, which can swallow their direct neighbors:</p>
  <ul>
  <li>Type X can swallow Type Y</li>
  <li>Type Y can swallow Type Z</li>
  <li>Type Z does nothing</li>
  </ul>
  <p>Count the minimum number of survivors.</p>
  <ul>
  <li>Cells are represented by a 1-dimensional array.</li>
  <li>A cell can swallow only specified types, according to the above rules</li>
  <li>If there are multiple ways, choose the most optimal, minimising the number of survivors</li>
  </ul>
  <pre><code>
  ## Example:
  
      C=[X,Y,Z,X,Z,Z,Y] 
  
  Answer is: 3.
   
  * C0 swallows C1, [X,Z,X,Z,Z,Y]
  * C5 swallows C4, then C3 [X,Z,X,Y]
  * C2 swallows C3 [X,Z,X]
  </code></pre>
  <p>How can such a function be implemented?</p>