Change file name on upload in Media Page

The best way of doing this might be to attach a custom field to each post to keep the increment {n}.

Something to the effect of:

$attach_inc = 1;

if ( is_single() ) {
    if ( $attach_inc = get_post_meta( $post_id, 'attachment_inc', true ) ) {
        $attach_inc++;
        update_post_meta( $post_id, 'attachment_inc', $attach_inc );
    } else {
        add_post_meta( $post_id, 'attachment_inc', $attach_inc );
    }
} else {
    if ( $attach_inc = get_option( 'attachment_inc' ) ) {
        $attach_inc++;
        set_option( 'attachment_inc', $attach_inc );
    } else {
        add_option( 'attachment_inc', $attach_inc );
    }
}

// DO YOUR ADD ATTACHMENT STUFF HERE