In the paper, an exact formula for the number of integral points in the system of ellipses related, according to Dirichlet, to an arbitrary imaginary quadratic field is provided. The relation of this formula to an arithmetic Riemann–Roch theorem is discussed. Previously, only nine formulas of such a type have been known. They correspond to the imaginary quadratic fields with the trivial class group.