#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<int64_t> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int64_t sum = 0;
  for (int i = 0; i < 60; i++) {
    int cnt = 0;
    for (int j = 0; j < n; j++) cnt += (a[j] >> i) & 1;
    int64_t tmp = cnt * (n - cnt) % mod;
    for (int j = 0; j < i; j++) tmp = tmp * 2 % mod;
    sum = (sum + tmp) % mod;
  }
  cout << sum << endl;
}
