Write each of the following as a mathematical equation.
Lacey made some cookies. She gave 8 to her best friend, then she divided the remainder into three halves for her classmates, and she still had 9 cookies left.