We provide explicit formulas for the number of vacua of four-dimensional pure N=1 super Yang-Mills theories on a circle, with any simple gauge algebra and any choice of center and spectrum of line operators. These form a key ingredient in the semi-classical calculation of the number of massive vacua of N=1* gauge theories with gauge algebra su(n) compactified on a circle. Using arithmetic, we express that number in an SL(2,Z) duality invariant manner. We confirm our tally of massive vacua of the N=1* theories by a count of inequivalent extrema of the exact superpotential. Furthermore, we compute a formula for a refined index that distinguishes massive vacua according to their unbroken discrete gauge group.