Hi Maria.
First of all are you confident you are able to safely isolate the supply?
It's quite difficult to make out the wiring diagrams from the photos but I would suggest the following.
Remove the link between L and Lin.
Connect brown to L and blue to N on the bottom of the new stat. Connect grey to Lin and black to SL(on).