#include<bits/stdc++.h>
const int N=2e5+5,U=1e6+5,mo=998244353;
int inv[U],f[U],g[U],mu[U],n,i,j,ans,a[N];
int main(){
	for(i=1;i<U;++i)inv[i]=i==1?1:1ll*(mo-mo/i)*inv[mo%i]%mo;
	for(i=mu[1]=1;i<U;++i)for(j=i*2;j<U;j+=i)mu[j]-=mu[i];
	for(i=1;i<U;++i)for(j=1;i*j<U;++j)f[i*j]=(f[i*j]+1ll*mo+inv[i]*mu[j])%mo;
	scanf("%d",&n);for(i=1;i<=n;++i)scanf("%d",a+i),g[a[i]]=(g[a[i]]+a[i])%mo,ans=(ans+mo-a[i])%mo;
	for(i=1;i<U;++i){
		for(j=i*2;j<U;j+=i)g[i]=(g[i]+g[j])%mo;
		ans=(ans+1ll*g[i]*g[i]%mo*f[i]%mo)%mo;
	}
	ans=1ll*ans*inv[2]%mo;
	printf("%d\n",ans);
	return 0;
}