# generating function for boolean algebras in weak bruhat order

In Stanley's book Enumerative Combinatorics I p.401, I found a problem that I need help to solve,,,:

$\sum_{n\geq 0}\sum_{i\geq 0} f(n,i)q^i\frac{x^n}{n!}=\frac{1}{1-x-\frac{qx^2}{2}}$ where $f(n,i)$ denotes the total number of intervals in the poset of weak order of $S_n$ that are isomorphic to the Boolean Algebra $B_i$...

Can anyone help me to solve this,,?