Add closing cost both while buying and selling the rental property to basis?

Bought a rental unit 3 years ago. Sold this year.
To get Basis-- should I do :

Purchase price   Closing costs while buying   Closing costs while selling.

or just:

Purchase price   closing costs while selling.
Thanks