#include <bits/stdc++.h>
using namespace std;
int dy[] = {0, 0, 1, -1};
int dx[] = {1, -1, 0, 0};
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  long long ans = 0;
  vll a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    ans += a[i] * (n - 1);
    ans %= (long long)(1e9 + 7);
  }
  long long now = 2;
  for (int i = 0; i < 60; ++i) {
    long long cnt = 0;
    for (int j = 0; j < n; ++j) {
      if (a[j] % 2 == 1) {
        cnt++;
      }
      a[j] /= 2;
    }
    cnt = cnt * (cnt - 1) / 2;
    cnt *= now;
    cnt %= (long long)(1e9 + 7);
    ans = (ans + (long long)(1e9 + 7) - cnt) % (long long)(1e9 + 7);
    now *= 2;
    now %= (long long)(1e9 + 7);
  }
  cout << ans << endl;
  return 0;
}
