Generalization of the Hohenberg–Kohn theorem to the presence of a magnetostatic field