O(log n) algorithm help !!!!!!

Hi,

I have a problem at hand and i kinda need a head start in the same.

I have an array with some values inside and basically i need to check if the array (index value+1) == the actual value in that index and if so, i need to increase a counter.

int a[] = {-1, 0, 2, 4, 5, 6, 7}

and the result shud be 4 for this because ther are 4 elements in this array which satisfy the condition... as, starting from index a[3] till a[6]....the value of index is equal to (index+1)

like a[3] = 4

a[4] = 5

a[5] = 6

a[6] = 7

but the catch is to do it in O(log N)...and not o(n).....can someone plz gimme a head start into solving this problem??

thnx in advance...plz reply soon...its urgent :) thnk yu