Help me in solving DIVIDEMAKEEQ problem

My issue

please explain the issue with this approach

My code

#include <iostream>
using namespace std;

int main() {
	int t;
	cin >> t;
	while(t--){
	    int n;
	    cin >> n;
	    long long arr[n];
	    long long min=100000000;
	    for(int i=0;i<n;i++){
	        cin >> arr[i];
	        if(min>arr[i]){
	            min=arr[i];
	        }
	    }
	    int count=0;
	    for(int i=0;i<n;i++){
	        if(arr[i]>min){
	            if(arr[i]%min!=0){
	                count=n;
	                break;
	            }else{
	                count++;
	            }
	        }
	    }cout << count <<endl;
	}
	return 0;
}

Problem Link: DIVIDEMAKEEQ Problem - CodeChef

I think the issue here is that you are checking only the minimum element as a factor. Try finding gcd of all the elements and then replace the min with gcd.