Each B cell requires 3 gates. Hence, 12 gates are needed for all four B cells.
The carries c1, c2, c3, and c4 produced by the carry-lookahead logic, require 2, 3, 4, and 5 gates, respectively. According to the four logic expressions,
c1 = G0 + P0c0
c2 = G1 + P1G0 + P1P0c0
c3 = G2 + P2G1 + P2P1G0 + P2P1P0c0
C4 = G3 + P3G2 + P3P2G1 + P3P2P1G0 + P3P2P1P0c0
The carry-lookahead logic also produces G0‘ using 4 gates, and P0‘ using 1 gate. Hence, 19 gates are needed to implement the carry-lookahead logic. The complete 4-bit adder requires 12 + 19 = 31 gates, with a maximum fan-in of 5.