#include <iostream>
#include <map>
using namespace std;

int main() {
    int n, target;
    map<int, int> dataSource;
    pair<int, int> temp; // 准备插入的键值对
    while (cin >> n) {
        dataSource.clear();  // 重置
        for (int i = 0; i < n; i++) {
            cin >> temp.first;
            temp.second = i;
            dataSource.insert(temp);
        }
        cin >> target;
        if (dataSource.find(target) == dataSource.end()) {
            cout << "-1" << endl;  // 未找到
        } else {
            cout << dataSource[target] << endl;  // 返回下标value
        }
    }
    return 0;
}