n=int(input()) nums=list(map(int,input().split())) mid=sum(nums)//n for x in range(n): nums[x]-=mid ans=0 v=0 for x in range(n): v+=nums[x] if v!=0: ans+=1 print(ans)