Think of the people at the party as the vertices of
a simple graph, where two people have an edge between
them if they shook hands. Then h(p) is the degree of
vertex p.
The sum of h(p) over all vertices p is the
sum of the degrees, which is twice the number of edges.
Any number doubled is even.