#include <bits/stdc++.h>
using namespace std;
constexpr long long mod = 1000000007;
long long unsigned n, a[300000], d[60][2];
int main() {
  cin >> n;
  for (long long unsigned i = 0; i < n; i++) {
    cin >> a[i];
    for (long long unsigned j = 0; j < 60; j++) {
      d[j][(a[i] & ((long long unsigned)1 << j)) ? 1 : 0]++;
    }
  }
  long long unsigned ans = 0;
  long long unsigned count = 1;
  for (int j = 0; j < 60; j++) {
    ans += count * d[j][0] * d[j][1] % mod;
    ans = ans % mod;
    count = (count * 2) % mod;
  }
  cout << ans;
}
