This is very common skin cancer myth that can be debunked by few minutes of googling.
Any change in your natural skin color is a sign of skin damage and that damage is cumulative. Getting a tan is a sign of damage. Total UV dose you build up over time, rather than getting sunburnt, matters most (Sunburn is used as a proxy for skin cancer risk because it is related to individual sun sensitivity and UV exposure).
UV radiation is complete carcinogen. It's both a mutagen and a non-specific damaging agent. It's both tumor initiator and a tumor promoter. Three most common types of skin cancer are basal cell carcinoma (BCC) , squamous cell carcinoma (SCC) and malignant melanoma. Chronic cumulative exposure is associated with BCC and SCC and melanoma with sunburns and childhood exposure but melanoma may develop through multiple pathways.