E = p1*v1 + p2*v2 + ... + pn*vn, where
n means the amount of events,
p2 means the probality of the second event,
v2 means the value of the second event.
Now n = 4, because "the number of heads" can be 0, 1, 2 or 3.
So v1=0, v2=1, v3=2, v4=3.
p1 = p(nothing heads) = 1/8.
p4 = p(all heads) = 1/8.
p2 = p(exactly one head) = p(the first head others tails) + p(the second head others tails) + p(the 3th head others tails) = 1/8 + 1/8 + 1/8 = 3/8.
I leave for you p3 and E.