This is solution of problem 12