The keypad on the PCA20031 board has 39 buttons.
The keyboard matrix is five rows by eight columns, providing 40 available buttons for firmware. Thirty-nine are used by the keypad with one unused. The matrix is connected directly to the nRF52810 SoC on the board.