#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 100000000;
ll i, j, k;
ll mod = 1000000007;
ll mypow(ll num1, ll num2) {
  ll number = 1;
  for (i = 0; i < num2; i++) {
    number *= num1;
  }
  return number;
}
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<ll> B(60, 0);
  for (i = 0; i < n; i++) {
    for (j = 0; j < 60; j++) {
      if ((a[i] >> j) & 1) {
        B[j]++;
      }
    }
  }
  ll ans = 0;
  for (i = 0; i < 60; i++) {
    ans += (mypow(2, i) * B[i] * (n - B[i]));
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
