n+3n(n-1)/2+2n(n-1)(n-2)/6