while True:
    try:
        n, val, k = int(input()), input().split(), int(input())
        print(val[n - k] if k else 0)
    except:
        break