A total of n bar magnets are placed end to end in a line with random independent orientations. Adjacent like poles repel while ends with opposite polarities join to form blocks. Let X be the number of blocks of joined magnets. Find E(X) and Var(X).