I believe the answer is 40. this is because if 30 people all know each other and hug and there are 10 people who don't know anyone and handshake, that means that since those 10 people know no one, then they also shake hands with the other 30 who do know each other. Im not sure if this is right but I hope it helps!