Counter of posts ever posted – even deleted ones

Depending on your needs, WP Query may not work for this since it won’t include posts that have been deleted after the trash has been emptied. This should work (but hasn’t been tested):

function wpse_custom_post_type_counter() {
     $number = get_option( 'wpse_custom_counter' ) ? absint( get_option( 'wpse_custom_counter' )  ): 0;
     $number++;
     update_option( 'wpse_custom_counter', $number );
}
add_action( 'publish_your_custom_post_type', 'wpse_custom_post_type_counter' );

You’ll need to update the function and option names to suit your application. Also the slug for your custom post type should replace your_custom_post_type in the call to add_action.

One disadvantage of this approach is that it will only work going forward, it won’t be able to count existing posts.

Hope that helps!