#include <stdio.h>
#include <string>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>

using namespace std;

template <typename T>
int len(T args) { return args.size(); }

vector<string> split(string &s, const char &c)
{
    string buffer{""};

    vector<string> resultado;

    for (char caractere : s)
    {
        if (caractere != c)
        {
            buffer += caractere;
        }
        else
        {
            resultado.push_back(buffer);
            buffer = "";
        }
    }
    if (buffer != "")
    {
        resultado.push_back(buffer);
        buffer = "";
    }

    return resultado;
}

int main()
{

    string linha;

    while (true)
    {
        getline(cin, linha);
        if (linha == "0")
        {
            break;
        }
        int n[atoi(linha.c_str())];

        getline(cin, linha);

        vector<string> temp = split(linha, ' ');

        int length = len(temp);

        for (int i = 0; i < length; i++)
        {
            string temp1 = temp[i].c_str();
            n[atoi(temp1.c_str()) - 1] = 1;
            if (n[i] != 1)
            {
                n[i] = 0;
            }
        }

        int length_n = sizeof(n) / sizeof(n[0]);

        for (int i = 0; i < length_n; i++)
        {
            if (n[i] == 0)
            {
                cout << (i + 1) << "\n";
                break;
            }
        }
    }
    return 0;
}