SV contraint to repeat elements n time

In reply to n347:

Hi, thank you for the solution. Can you please explain how this statement work?

a.sum() with ((item == 1) ? 1 :0) == 10;