title: Prolog count the number of times a predicate is true
body: <p>I want to count the number of times a custom predicate is true.
  For example, I have the following code:</p>
  <pre><code>is_man(john).
  is_man(alex).
  ?:-is_man(X).
  </code></pre>
  <p><code>X</code> will return <code>john</code>, then if I press semicolon it will also return <code>alex</code>, then <code>false</code>.</p>
  <p>I want to build something like:</p>
  <pre><code>count(is_man(X), Count).
  </code></pre>
  <p>And this to return</p>
  <pre><code>Count = 2
  </code></pre>
  <p>How can I do that?</p>