#include using namespace std; int main() { int N; for (int i = 1; i <= 10; i++) { cin >> N; if (N != i) { break; } } cout << N-1 << endl; return 0; }