How d0 i get the number of attachments in the post

Use following code to do the work :

global $post;
$page_id = $post->ID;
$all_attachments = get_posts( array( 'post_type' => 'attachment','post_mime_type' => 'image', 'post_parent' => $page_id, 'post_status'=>'published',  'numberposts' => -1 ) );

$no_of_photos = count($all_attachments); // Gets the number of photo's attached in $no_of_photos variable
$first_img_URL = get_permalink($all_attachments[0]->ID); // Gets the URL of first attachment in  $first_img_URL variable

In the above code just replace the $page_id to the id of page/post to which the photos are attached.