```
class Solution:
# @param num, a list of integer
# @return an integer
def findPeakElement(self, num):
n=len(num)
i=0
greatestVar=num[0]
greatestIndex=0
while i<n-1:
if greatestVar>num[i]:
i=i+1
elif n==1:
greatestIndex=0
else:
greatestVar=num[i]
greatestIndex=i
i=i+1
return greatestIndex
```