#include <iostream> using namespace std; const int N = 1e5+10; bool st[N]; int main() { int n,m; cin>>n; int n1 = n; while(n--){ cin>>m; st[m] = true; } for(int i=0;i<=n1;i++){ if(st[i]==false){ cout<<i; break; } } } // 64 位输出请用 printf("%lld")