#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<long long> d0(60, 0), d1(60, 0);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      if (a[i] & 1)
        d1[j]++;
      else
        d0[j]++;
      a[i] >>= 1;
    }
  }
  long long ans = 0;
  long long x = 1;
  for (int i = 0; i < 60; i++) {
    ans = (ans + d0[i] * d1[i] * x % mod) % mod;
    x = x * 2 % mod;
  }
  cout << ans << endl;
  return 0;
}
