title: Count the number of duplicated values
body: <p>I am trying to run function that will take one parameter, which is list of numbers, and count the duplicates.</p>
  
  <p>Example:</p>
  
  <pre><code>number &lt;- c(1, 1, 1, 2, 2, 4, 5)
  </code></pre>
  
  <p>In this case, the output will be 2, because only 1 and 2 have duplicates. </p>
  
  <p>I know how to use for loop but not sure how to count duplicates.</p>
  
  <pre><code>count = 0
  for (x in number){
      ...
  }
  </code></pre>