counting code and maping