please help me solve this equation in O(1) or O(logn) time.

1<=n<=10^18

equation:

(n-1) + (n-2)*(n-3)/2! + (n-3)(n-4)(n-5)/3! + (n-4)(n-5)(n-6)(n-7)/4! +…+ (n-(n/2))*(n-(n/2+1))*…*(n-(n-1))/(n/2)!

or this eqvivalent combinatric equation

sum of C(n-k,k) for all 1<=k<=floor(n/2)