If you want to avoid the wash-sale rule, you should wait at least 30 days before repurchasing the same or a substantially identical security.