#include <iostream>
using namespace std;

int main() {
	int n;
	cin >> n;
	int smallest = 0, biggest = n + 1, x;
	for (int i = 1; i < n; ++i) {
		cin >> x;
		if (biggest - x >= x - smallest) {
			biggest = x;
		} else {
		    smallest = x;
		}
	}
	if (biggest - smallest >= 2 || smallest - biggest >= 2) {
		if (biggest > smallest) {
		    cout << smallest + 1;	
		} else {
		    cout << smallest - 1;
		}
	} else if (smallest == 0) {
		cout << n;
	} else {
	    cout << 1;
	}
}