Pregnancy test?!

How many days after having sex can you take a pregnancy test??