My understanding is that you count the "midnights". In otherwords it's as Niel said. If you leave the UK on a friday you don't count Friday.
I don't think it matters what you are doing (work or pleasure) when you are in the UK but try calling the Inland Revenue for Non-Residents to check...
http://www.hmrc.gov.uk/cnr/ and
http://www.hmrc.gov.uk/menus/contactus.shtml
The rules are complex as various sportsman have found out recently.