solve #2 problem