A function f(a,b) equals number of bits two numbers a and b differ in the base 2 representation. Given a set of numbers in an array A [1, 3, 5], find the sum of f(i,j) over all pairs of numbers.

Example: [1,3,5]

f(1,3) = 01, 11 -> 1

f(3,5) = 11, 101 ->2

f(5,1) = 101, 001 ->1

Sum = 1 + 2 + 1 = 4.