Semiclassical formula for the number variance of the Riemann zeros