Smarter dogs have smaller brains, surprising study reveals