I have an image which has a number of shapes, all are the same color and on a white background. Is there a quick way of counting how many shapes there are?

I don't want to know what shape they actually are (polygon, circle or whatever), I just want to know how many isolated shapes are present. Other than some kind of brute force method, I can't find any other way of doing this.