Count pixels with the same statement inserting them to pyramid