Header and Footer ads: Only make them visible when 2+ posts on page?


I want only to show ads on my multisite blogs in the header and footer, when there is more than 2 or 3 posts on the page. The ad codes is placed in my themes header.php and footer.php. Is it possible with the WP post counter in some way?

Right now i have an ad that does exactly that, but it is in the index.php file, and the theme author told me that it is not possible the same way in the header and footer.

Please help.