The classical Barvinok bound for the sum of the Betti numbers of the intersection X of three quadrics in RPn says that there exists a natural number a such that b(X) <= n(3a). We improve this bound proving the inequality b(X) <= n(n + 1). Moreover we show that this bound is asymptotically sharp as n goes to infinity.