How many pins does this circuit (HMC5883L) use?
Below image is the answer to your question.



According to this image, magnetometer required four pins of arduino.

GND of magnetometer ----> Arduino GND

Vcc of magnetometer ----> Arduino 3.3 Volt

SDA of magnetometer ----> Arduino Analog Pin 4

SCL of magnetometer ----> Arduino Analog Pin 5

A4, A5 on Uno are SDA, SCL, required for hardware-based I2C.

I hope it will help you.