#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
int n;
long long cnt[61];
long long a[N], ans;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < 60; ++j) {
      if ((a[i] & (1ll << j)) == 0)
        continue;
      else
        ++cnt[j];
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < 60; ++j) {
      if ((a[i] & (1ll << j)) == 0)
        ans = (ans + ((1ll << j) * cnt[j]) % mod) % mod;
    }
  }
  cout << ans;
}
