Source: https://cs.wellesley.edu/~cs240/s17/slides/bits-handout.pdf