Number of spins can be passed as an argument