In this case, 1 company signed a 1-2 contract with the second company, and the second company signed a 2-1 contract with1company, but in fact these two contracts are the same, and we counted them twice. Similarly, the total number of our contracts should be n*(n- 1)/2.
From the known, 45=n*(n- 1)/2, the solution is n= 10, so there are 10 companies involved.