#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
template <class T>
void dbs(string str, T t) {
  cout << str << " : " << t << endl;
}
template <class T, class... second>
void dbs(string str, T t, second... s) {
  int idx = str.find(',');
  cout << str.substr(0, idx) << " : " << t << ",";
  dbs(str.substr(idx + 1), s...);
}
template <class second, class T>
ostream& operator<<(ostream& os, const pair<second, T>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, const set<T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class second, class T>
ostream& operator<<(ostream& os, const map<second, T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class T>
void prc(T a, T b) {
  cout << "[";
  for (T i = a; i != b; ++i) {
    if (i != a) cout << ", ";
    cout << *i;
  }
  cout << "]";
  cout << endl;
}
const int N = 1e6;
int sum[N + 1], p2[N + 1];
int f[N + 1], m[N + 1];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = (0); i <= (n - 1); ++i) cin >> a[i], f[a[i]]++;
  for (int i = (N); i >= (1); --i) {
    for (int j = i; j <= N; j += i) {
      m[i] += f[j];
    }
  }
  p2[0] = 1;
  for (int i = (1); i <= (N); ++i) {
    p2[i] = p2[i - 1] + p2[i - 1];
    if (p2[i] >= inf) p2[i] -= inf;
  }
  int ans = 0;
  for (int g = (N); g >= (2); --g) {
    sum[g] = (p2[m[g] - 1] * 1LL * m[g]) % inf;
    for (int i = g + g; i <= N; i += g) {
      sum[g] -= sum[i];
      if (sum[g] < 0) sum[g] += inf;
    }
    ans += (sum[g] * 1LL * g) % inf;
    if (ans >= inf) ans -= inf;
  }
  cout << ans;
  return 0;
}
