Help me in solving REDUARRAY problem

My issue

cook your dish here

T = int(input())
while T:
N = int(input())
A = list(map(int,input().split()))
arr =
for i in list(set(A)):
s = i*(len(A)-A.count(i))
arr.append(s)
print(min(arr))
T = T - 1

My code

# cook your dish here
T = int(input())
while T:
    N = int(input())
    A = list(map(int,input().split()))
    arr = []
    for i in list(set(A)):
        s = i*(len(A)-A.count(i))
        arr.append(s)
    print(min(arr))
    T = T - 1

Problem Link: Redundant Array Practice Coding Problem
Thanks for helping!

you code will be failling on test case like this
n=2
3 4
your ans 3
but correct ans 2
we can change all element to 1 cost =(2)*1=2