at least 6 weeks!!! depending on your health condition
you need to wait until it completely heal before sex.
complication/infection and even skin tearing may happens if not completely healed
you may lose some sensation too...and you may require condom/protected sex for a while until you get use to...
i m not a doctor but a friend of mine got a consultation because of constant urinal infection even clean up properly...it was years ago...
it was so funny after his operation....walking weird for the 2 first week and constant pain and irritation for a while and took him more than 8 weeks to completely healed!
and no sex or masturbation...