Please see https://pressbooks.library.upei.ca/montelpare/chapter/computing-the-sign-test/
References
https://pressbooks.library.upei.ca/montelpare/chapter/computing-the-sign-test/