E already has a green roof.
Adjacent houses cannot use any colour that the next house uses, so D cannot have a green roof (because E has green).
B already has a red roof, so only A and C are free to possibly take green roofs.
We can choose roofs:
A – green, B – red, C – green, D – yellow, E – green
This satisfies all rules and gives 3 green roofs (A, C, E).
We cannot make B or D green, so more than 3 green roofs is impossible.