Count images in post then add class if just one

Using @pascalvgemert’s suggestion as a starting point, I’m using the following script:

jQuery(document).ready(function() {
    var imgCount = jQuery(".single-post #content-left p a").children("img").length;
    if (imgCount == 1) {
    jQuery("img").addClass("lone-image");
    }
});

Works like a charm.