#include <bits/stdc++.h>
using namespace std;
template <class T>
ostream& operator<<(ostream& os, vector<T> V) {
  os << "[ ";
  for (auto v : V) os << v << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, set<T> S) {
  os << "{ ";
  for (auto s : S) os << s << " ";
  return os << "}";
}
template <class L, class R>
ostream& operator<<(ostream& os, pair<L, R> P) {
  return os << "(" << P.first << "," << P.second << ")";
}
template <class L, class R>
ostream& operator<<(ostream& os, map<L, R> M) {
  os << "{ ";
  for (auto m : M) os << "(" << m.F << ":" << m.S << ")";
  return os << "}";
}
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int N = 1e6 + 100;
const long long mod = 1e9 + 7;
long long freq[N];
long long power(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(25);
  int n;
  cin >> n;
  long long x;
  for (int i = 0; i < n; ++i) {
    cin >> x;
    for (int i = 1; i * i <= x; ++i) {
      if (x % i != 0) continue;
      if (i * i == x) {
        freq[i]++;
        break;
      } else {
        freq[i]++;
        freq[x / i]++;
      }
    }
  }
  long long ans = 0;
  for (int i = N - 1; i >= 1; i--) {
    if (freq[i]) freq[i] = (power(2, freq[i] - 1)) * freq[i] % mod;
    for (int j = 2 * i; j < N; j += i) {
      freq[i] -= freq[j];
      if (freq[i] < 0) freq[i] += mod;
    }
    if (i != 1) ans = (ans + i * freq[i]) % mod;
  }
  cout << ans << "\n";
  return 0;
}
