@Warlock lord
yes F() is called logn times, but complexity of F() will not be O(n) in every call, it will also decrease with n.
it will go like-> n + n/2 + n/4 + n/8.........logn times = O(n)
what you are doing is -> n + n + n + n...........logn times = O(nlogn) // this is incorrect