What is the maximum number of black and white pieces which are relevant in a checkmate position (by White)? That is if any piece (black or white) was removed from the board, the checkmate would not be possible because that piece is relevant or has a role in such checkmate position because it may be: (1) checking the king (2) blocking a square where the checked king can move (3) attacking the unoccupied square where the checked king can move (4) preventing the king or other pieces to capture or block the checking piece. (Note that there shall be no idle or useless piece including the White king)
Addendum 6/24/2023: It turns out that 20 pieces actually can be done in a manner that feels so obvious now. Removing wPf6 would cause an illegal position, and removing wBg7 would leave f6 unguarded.
[FEN "8/2B1R1B1/1N1rnP2/1Qq1knR1/2p2r2/2K1bPB1/3PR3/8 w - - 0 1"]
I found another, far funnier, reason why a piece can't be removed; the position would otherwise be illegal!
Using this idea, I've managed 19 pieces. White's pieces can't be taken, with the White king unmoveable, or else the checkmate is null. Black's pieces prevent illegality and "guard" c4, minus the e6 block.
[FEN "8/2B1R3/1N1rnp2/1Qq1knR1/2pP1r2/2K1bPB1/4R3/8 w - - 0 1"]