Help me in solving AO09 problem

My issue

this program is not running and the status has been showing ‘time limit exceeded’

My code

# Update the code below to solve the problem

t = int(input())
for i in range(t):
    N = int(input())
    A = list(map(int, input().split()))
    
    A = sorted(A)
    count = 1 
    highest_count = 1 
    i = 0
    while i < (N-1):
        if A[i] == A[i+1]:
            count += 1
            if highest_count < count:
                highest_count = count
            else:
                count = 1
            i += 1 
    print(N - highest_count)
    

Learning course: Solve Programming problems using Python
Problem Link: CodeChef: Practical coding for everyone

@asthajain11
Since u r coding in python u have to take care of the indentation .
U have made two mistakes in indentation .
I have corrected it, hope u will get it.


t = int(input())
for i in range(t):
    N = int(input())
    A = list(map(int, input().split()))
    
    A = sorted(A)
    count = 1 
    highest_count = 1 
    i = 0
    while i < (N-1):
        if A[i] == A[i+1]:
            count += 1
            if highest_count < count:
                highest_count = count
        else:
            count = 1
        i += 1 
    print(N - highest_count)