using pop count to compute grid similarity.