Find Majority Elements

Test case 5 failing at time of submission. Can someone point out the case I’m missing in my case ?

n=int(input())
l=[int(ele) for ele in input().strip().split()]

e1=l[0]
e2=0
c1=1
c2=0
for i in l:
    if e1==i:
        c1+=1
    elif e2==i:
        c2+=1
    elif c1==0:
        e1=i
        c1=1
    elif c2==0:
        e2=i
        c2=1
    else:
        c1-=1
        c2-=1


c1=0
c2=0
for i in l:
    if i==e1:
        c1+=1
    elif i==e2:
        c2+=1
ans=[]
# thresh=n//3
if c1>=(n//3):
    ans.append(e1)
if c2>=(n//3):
    ans.append(e2)
print(*ans) if len(ans)>0 else print("No Majority Elements")

what if n<3?
this is where it is failing
more precisely, what if n=1?
if there is only one element c2 and c1 will both be >=n/3 always but there is only one element so e2 should not be appended but in ur code it will get appended

Not very clear. Give example

consider there is only one element, then what you should return, only that one element, right
but if c2>=(n//3): is true because here c2 will be 0 which is >= n/3 which is also equal to 0
so it will append e2 which is initially zero, but this is wrong
similarly, what if there are only two elements which are 1 and 1
i.e. they are same still, it will still cause the same problem