A good rule is two maybe even three duplications is ok. After that, probably tome to refactor at least a little. Often this rule of thumb saves some efforts.
The rule should not be primarily based on a number of duplications but if we know that all the duplicated parts need to be changed when one is changed.