Untitled

 avatar
unknown
plain_text
4 years ago
516 B
5
Indexable
#include <bits/stdc++.h>
#define ll long long
#define endl '/n'
using namespace std;

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);

// Code goes here //
    int n;
    cin>>n;
    set <int> s;
    for (int i =0 ; i<n;i++)
    {
        int x;
        cin>>x;
        if (x>0)
            s.insert(x);
    }
    for (int i=1 ; i<=n+1 ; i++)
    {
        if (!s.count(i))
        {
            cout<<i;
            break;
        }
    }
    }
Editor is loading...