Figured out 'counting stars' algorythm