Fix script for counting density

Signed-off-by: Michael Barton <mail@michaelbarton.me.uk>