  The recently proposed technique to regularize the divergences of the
gravitational action on non-compact space by adding boundary counterterms is
studied. We propose prescription for constructing the boundary counterterms
which are polynomial in the boundary curvature. This prescription is efficient
for both asymptotically Anti-de Sitter and asymptotically flat spaces. Being
mostly interested in the asymptotically flat case we demonstrate how our
procedure works for known examples of non-compact spaces: Eguchi-Hanson metric,
Kerr-Newman metric, Taub-NUT and Taub-bolt metrics and others. Analyzing the
regularization procedure when boundary is not round sphere we observe that our
counterterm helps to cancel large $r$ divergence of the action in the zero and
first orders in small deviations of the geometry of the boundary from that of
the round sphere. In order to cancel the divergence in the second order in
deviations a new quadratic in boundary curvature counterterm is introduced. We
argue that cancelation of the divergence for finite deviations possibly
requires infinite series of (higher order in the boundary curvature) boundary
counterterms.
