#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long po[60];
void calc() {
  po[0] = 1;
  for (int i = 1; i < 61; i++) po[i] = po[i - 1] * 2;
}
int main() {
  ios_base::sync_with_stdio(false);
  calc();
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int bits[60];
  memset(bits, 0, sizeof(bits));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      if (po[j] & a[i]) bits[j]++;
    }
  }
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    int left = (n - bits[i]) * bits[i];
    ans += ((left) * ((po[i]))) % mod;
  }
  ans %= mod;
  cout << ans;
}
