The Galaxy Mass Function up to z=4 in the GOODS-MUSIC sample: into the epoch of formation of massive galaxies