Probing the Upper Scorpius mass function in the planetary-mass regime