: Taking as a starting point (a modification of) a weak theory of arithmetic of Jan Johannsen and Chris Pollett (connected with the hierarchy of counting functions), we introduce successively stronger theories of bounded arithmetic in order to set up a system for analysis (TCA2 ). The extended theories preserve the connection with the counting hierarchy in the sense that the algorithms which the systems prove to halt are exactly the ones in the hierarchy. We show that TCA2 has the exact strength to develop Riemannian integration for functions with a modulus of uniform continuity. Key Words: Weak analysis, Riemann integral, counting hierarchy