Here's the code:
n = int(input())
arr = input().split()
arr = [int(x) for x in arr]
smallest = 1001
count = 0
smallest = arr
for i in arr:
i-=smallest #This statement.
Let's look at the inside loop
for i in arr: if i==0: arr.remove(i) i-=smallest count+=1
It assigns the first value in
i. Since no value of the array is zero, it doesn't remove anything from the list.
It then reassigns the value of i by subtracting the smallest value. For the first time through the loop it assigns the value of zero to i. Then it increments count. The list
arr is unchanged. The line
i=-smallest has no effect since
i is reassigned to the next value of the list.
So, with the values 5 4 4 2 8 8 (none of which are zero) that loop is equivalent to
for i in arr: count+=1
Which is why it always prints 6. I'm not sure why you think it should print 6 4 2 1. I suspect you think the list is being changed, but that the line
if i==0 is always false.
Changing the object being iterated over in a for loop is guaranteed to confuse you. There is almost certainly a better way to achieve what you want. See for example Remove items from a list while iterating in Python