How to find the number of processors from dmidecode output?

If you have access to the system, you would probably use lscpu, nproc or /proc/cpuinfo. How do you find the number of available CPUs in a Linux server from dmidecode output if that is all you have?

$ grep CPU dmidecode_output.txt 
Socket Designation: CPU 0
Socket Designation: CPU 1
Socket Designation: CPU 2
Socket Designation: CPU 3
Socket Designation: CPU 4
Socket Designation: CPU 5
Socket Designation: CPU 6
Socket Designation: CPU 7
How to find the number of processors from dmidecode output?