Add NotEqual constraint

It's just an inversion of the Equal constraint, so some code was moved
around to make sharing it easier.
Add Count constraint

Counts number of variables with a certain value.