Update pi-montecarlo example to use `sum` again.

Now that `sum()` works with boolean arrays again, we can restore the original implementation of the `pi-montecarlo` example and use `sum()` instead of a custom local function.