A proof of the Göttsche-Yau-Zaslow formula