#include <iostream>
#include <algorithm>

using namespace std;

const int N = 1000;

int gcdx(int a,int b){
	return b ? gcdx(b,a % b):a;
}
int main(){
	int n;
	
	while(cin >> n){
		if(n == 0)break;
		int a[N],count = 0;
		for(int i = 0;i < n;i ++)cin >> a[i];
		sort(a,a + n);
	
		
		for(int i = 0;i < n;i ++){
			for(int j = 0;j < n;j ++){
				if(i != j){
					if(a[i] / a[j] == 0 ){
						if( (a[j] * a[i] / gcdx(a[i],a[j])) == a[j] * a[i]){
							count ++;
							
						}
					
					}
				}
			}
		}
		cout << count << endl;
	}	
	return 0;
}