Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
a = [- int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  if a[i] >= max(tmp):
    tmp.append(a[i])
  else:
    index=bisect.bisect_right(tmp,a[i])
    tmp[index] =a[i]
print(len(tmp))

Fixed submission:
import bisect
n = int(input())
a = [- int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  idx=bisect.bisect_right(tmp,a[i])
  if idx==len(tmp):
    tmp.append(a[i])
  else:
    tmp[idx] =a[i]
print(len(tmp))

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left
import sys
n = int(input())
tmp=[int(input())]
if n == 1:
  print(1)
  sys.exit()
for i in range(n-1):
  a = int(input())
  idx = bisect_left(tmp,a)
  if idx==0:
    tmp.insert(0,a)
  else:
    tmp[idx-1] =a
print(len(tmp))

Fixed submission:
import bisect
n = int(input())
a = [- int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  idx=bisect.bisect_right(tmp,a[i])
  if idx==len(tmp):
    tmp.append(a[i])
  else:
    tmp[idx] =a[i]
print(len(tmp))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect,sys
n = int(input())
A = [int(input()) for i in range(n)]
tmp = [A[0]]
if n == 1:
  print(1)
  sys.exit()
for a in A[1:]:
  idx = bisect.bisect_left(tmp,a)
  if idx==0:
    tmp.insert(0,a)
  else:
    tmp[idx-1] =a
print(len(tmp))

Fixed submission:
import bisect
n = int(input())
a = [- int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  idx=bisect.bisect_right(tmp,a[i])
  if idx==len(tmp):
    tmp.append(a[i])
  else:
    tmp[idx] =a[i]
print(len(tmp))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect,sys
n = int(input())
A = [int(input()) for i in range(n)]
tmp = [A[0]]
if n == 1:
  print(1)
  sys.exit()
for a in A[1:]:
  if a <= min(tmp):
    tmp.insert(0,a)
  else:
    tmp[bisect.bisect_left(tmp,a)-1] =a
print(len(tmp))

Fixed submission:
import bisect
n = int(input())
a = [- int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  idx=bisect.bisect_right(tmp,a[i])
  if idx==len(tmp):
    tmp.append(a[i])
  else:
    tmp[idx] =a[i]
print(len(tmp))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
a = [int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  if a[i] <= min(tmp):
    tmp.insert(0,a[i])
  else:
    index=bisect.bisect_left(tmp,a[i])
    tmp[index-1] =a[i]
print(len(tmp))

Fixed submission:
import bisect
n = int(input())
a = [- int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  idx=bisect.bisect_right(tmp,a[i])
  if idx==len(tmp):
    tmp.append(a[i])
  else:
    tmp[idx] =a[i]
print(len(tmp))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n = int(input())
a = [int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  if a[i] <= min(tmp):
    tmp.append(a[i])
    tmp=sorted(tmp,reverse=True)
  else:
    index=bisect.bisect_left(tmp,a[i])
    tmp.insert(index,a[i])
    del tmp[index-1]
print(len(tmp))

Fixed submission:
import bisect
n = int(input())
a = [- int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  idx=bisect.bisect_right(tmp,a[i])
  if idx==len(tmp):
    tmp.append(a[i])
  else:
    tmp[idx] =a[i]
print(len(tmp))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  if a[i] <= min(tmp):
    tmp.append(a[i])
    tmp=sorted(tmp,reverse=True)
  else:
    for j in range(len(tmp)):
      if a[i]>tmp[j]:
        tmp[j]=a[i]
        break
print(len(tmp))

Fixed submission:
import bisect
n = int(input())
a = [- int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  idx=bisect.bisect_right(tmp,a[i])
  if idx==len(tmp):
    tmp.append(a[i])
  else:
    tmp[idx] =a[i]
print(len(tmp))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  if a[i] <= min(tmp):
    tmp.append(a[i])
  else:
    for j in range(len(tmp)):
      if a[i]>tmp[j]:
        tmp[j]=a[i]
        break
print(len(tmp))

Fixed submission:
import bisect
n = int(input())
a = [- int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  idx=bisect.bisect_right(tmp,a[i])
  if idx==len(tmp):
    tmp.append(a[i])
  else:
    tmp[idx] =a[i]
print(len(tmp))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
pre=[]
for i in a:
  if len(pre)==0:
    pre.extend([[i]])
  else:
    flg=0
    for j in range(len(pre)):
      if pre[j][-1] < i:
        pre[j].append(i)
        flg=1
        break
    if flg==0:
      pre.extend([[i]])
print(len(pre))

Fixed submission:
import bisect
n = int(input())
a = [- int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  idx=bisect.bisect_right(tmp,a[i])
  if idx==len(tmp):
    tmp.append(a[i])
  else:
    tmp[idx] =a[i]
print(len(tmp))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
cnt=0
while len(a)>0:
  cnt+=1
  nokori=[]
  tmp = a[0]
  for i in range(1,len(a)):
    if tmp<a[i]:
      tmp=a[i]
    else:
      nokori.append(a[i])
  a = nokori
print(cnt)


Fixed submission:
import bisect
n = int(input())
a = [- int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  idx=bisect.bisect_right(tmp,a[i])
  if idx==len(tmp):
    tmp.append(a[i])
  else:
    tmp[idx] =a[i]
print(len(tmp))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(input()) for i in range(n)]
cnt=0
while len(a)>0:
  cnt+=1
  nokori=[]
  tmp = a[0]
  for i in range(1,len(a)):
    if tmp<a[i]:
      tmp=a[i]
    else:
      nokori.append(a[i])
  a = nokori
print(cnt)

Fixed submission:
import bisect
n = int(input())
a = [- int(input()) for i in range(n)]
tmp = [a[0]]
for i in range(1,n):
  idx=bisect.bisect_right(tmp,a[i])
  if idx==len(tmp):
    tmp.append(a[i])
  else:
    tmp[idx] =a[i]
print(len(tmp))