// https://www.geeksforgeeks.org/search-an-element-in-an-array-where-difference-between-adjacent-elements-is-1/
#include <iostream>
using namespace std;
int main() {
int n,x;
cin>>n;
int a[n];
for (int i=0;i<n;i++)
cin>>a[i];
cout<< "Enter the search element: ";
cin >> x;
int i=0;
while (i<n){
if (a[i]==x){
cout<< "Index is: "<<i;
exit(0);
}
i+=abs(a[i]-x);
}
cout<< "Element is not present!";
}