	#include <iostream>
	#include <bits/stdc++.h>

	using namespace std;

	#define ll long long
	#define LL unsigned long long 
	#define NL <<"\n" 
	#define vec(x) vector<x>
	#define emb(x)  emplace_back(x)
	#define fall(x) x.begin(),x.end()
	#define rfall(x) x.rbegin(),x.rend()
	#define fo(a,b) for(long long i=a; i < (b); i++)
	#define fset(x) setprecision(x) << fixed
	#define fast ios::sync_with_stdio(NULL); cin.tie(0); cout.tie(0);



	/*
	 *---------------------------------------------
	 * --------------------------------------------
	 * --------------------------------------------32
	 * 
	العمل الجاد يتفوق على الموهبة الكسولة

	 * 勤勉は怠惰な才能に勝る
	 * 
	 * 努力打敗懶惰的人才
	 * 
	  * कड़ी मेहनत आलसी प्रतिभा को हरा देती है
	  * 
	 * тяжелая работа превосходит ленивый талант
	 * 
	 * 勤勉は怠惰な才能に勝る
	 * 
	 * 努力打敗懶惰的人才
	 * 
	 * malfacila laboro superas maldiligentan talenton
	 * 
	 * el trabajo duro supera al talento perezoso
	 * 
	 * η σκληρή δουλειά κερδίζει τεμπέλης ταλέντο
	 * 
	 * il duro lavoro batte il talento pigro
	 * 
	 * munca grea bate talentul leneș
	 * 
	 * kazi ngumu hupiga talanta ya uvivu
	 * 
	 * piger ingenii labore verberat
	 * 
	 * làm việc chăm chỉ đánh bại tài năng lười biếng
	 * 
	 * trabalho duro vence talento preguiçoso
	 * 
	 * працавітасць перамагае лянівы талент
	 * 
	 * le travail acharné bat le talent paresseux
	 * 
	 * --------------------------------------------------
	 * --------------------------------------------------
	 * --------------------------------------------------
	*/
	#define mod 100000000000000007

	ll powb(ll a, ll b=2){
		
		ll res = 1;
		while(b){
			if(b&1)res = (res)%mod * (a)%mod;
			
			
			a = (a)%mod*(a)%mod;
			
			b>>=1;
		}
		
		return res;
		}

	void runcase(){


		int n;
		cin>>n;

		int arr[n];
		
		fo(0,n){
			cin>>arr[i];
			arr[i]+=200;
		}
		
		vec(int) ch(401);
		
		
		fo(0,n){
			ch[arr[i]]++;
		}
		
		vec(int) real,pos;
		
		
		fo(0,401){
			if(ch[i]){
				real.emb(i-200);
				pos.emb(ch[i]);
			}
		}

		int l = real.size();
			
		ll ans=0;
			
		for(int i = 0; i < l; i++){
			for(int j = i+1; j< l; j++){
				ans+=powb(real[i]-real[j])*((pos[i])%mod*(pos[j])%mod)%mod;
			}
		}

		
		cout << ans;
		cout NL;
		}

	int main(){
		
			fast
			
			ll t;

			
			t=1;
			// cin>>t;
			
			while(t--){
				
					runcase();
			}
			
		
		
		return 0;
		}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m); (i) > (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repr(i, n) REPR(i, n, 0)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define in(a) insert(a)
#define P(p) cout<<(p)<<endl;
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SORT(a) sort((a).begin(), (a).end())
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long int> vll;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
void sonic(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 998244353;
const ld PI = acos(-1);
template<typename T> void co(const vector<T>& v){for(const auto& e : v)
    { cout << e << " "; } cout << "\n";}
const ld EPS = 1e-11;
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
template<typename T> void co(T e){cout << e << "\n";}



const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


inline ll ksm(ll a,ll b,const ll m=MOD) {
    int ans = 1;
    while (b) {
        if (b & 1) ans = 1ll * ans * a % m;
        a = 1ll * a * a % m;
        b >>= 1;
    }
    return ans;
}


set<int> divisor(int n) {
    set<int> ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.insert(i);
            if (i * i != n) ret.insert(n / i);
        }
    }
    // sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}



int main(){
    int n, ans=0;
    cin>>n;
    vector<int> A;
    set<int> B;
    rep(i,n){
        int l;
        cin>>l;
        A.push_back(l);
        set<int> C;
        C=divisor(l);
        B.insert(C.begin(),C.end());
    }

    for(auto i:B){
        bool flg=true;
        int ret=0;
        bool flg2=true;
        rep(j,n){
            if(i>A[j]) {
                flg2 = false;
                break;
            }
            if(A[j]%i==0){
                if(flg){
                    ret = A[j]/i;
                    flg=false;
                }
                else ret = __gcd(ret, A[j]/i);
            }
            }
        if(flg2&&ret==1)ans++;
        }
    co(ans);
}
