Trying to backup and clean up photos. Numbers don’t match

Prior to reinstalling my phone from scratch I want to make sure I had a back up of all of my photos. I went to the photos app on my Mac and exported all the photos and ended up with close to 40,000. The Photos hotos tells me that there’s only 26,000 photos where the extra photos come from. I’m not really one who edits their photos a lot certainly not 20,000 of them