Python. Recurring error in int condition. : Aleksa is having a New Year's Eve party! His house has a magic doorway that only allows  person to enter per  second, and he knows  people will show up.

If two guests arrive at same time, one guest must wait for the other to enter. If two guests arrive at different times, the guest arriving first must enter first.

Given the arrival times for all  guests, determine the entry time of the last guest.

Input Format

The first line contains an integer, , denoting the number of guests. 
The second line contains  integers, , where  is the arrival time of  guest.

Constraints



Output Format

Print the time that the last guest enters the magic doorway.

Sample Input 1:

8

2 2 2 2 4 4 4 6 

Sample Output 1:

9

Sample Input 2:

3

2000 2015 2015

Sample Output 2:

2016

HERE IS MY CODE> PLEASE TELL ME THE ERROR AND RATE MY LOGIC

 
1
N=int(input())

2
pop=list(map(int,input().split()))

3
na=[]

4
kar=[]

5
count=0

6
for x in range(6666666666666):

7
         if pop!=list():

8
        ol=min(pop)

9
        for item in pop:

10
            if item==ol:

11
                na.append(item)

12
                pop.remove(item)

13
            else:

14
                pass

15
        kol=len(na)

16
        na=[]

17
        if kar==list():

18
            count=ol+(kol-1)

19
            kar.append(count)

20
        elif kar!=list() and kar[-1]>ol:

21
            top=kar[-1]+kol

22
            kar.append(top)

23
        elif kar!=list() and kar[-1]<ol:

24
            pop=ol+kol-1

25
            kar.append(pop)

26
    elif pop==list():

27
        print(kar[-1])

28
        break
29
        
30
    I am getting an error like this:
Traceback (most recent call last):
  File "solution.py", line 8, in <module>
    ol=min(pop)
TypeError: 'int' object is not iterable


Any suggestions and please tell me if my logic is correct and good enough? I am a beginner who started python three weeks back.
