title: PostgreSQL: get count of occurrences of specified element in array
body: <p>I need to calculate the count of occurrences of specified element in array, something like:</p>
  <blockquote>
  <p><code>elem_occurrences_count(ARRAY[a,b,c,a,a], a) = 3</code></p>
  <p><code>elem_occurrences_count(ARRAY[a,b,c], d) = 0</code></p>
  </blockquote>
  <p>Is there any function in PostgreSQL that can be used to solve the problem? Any help is appreciated.</p>