#include <bits/stdc++.h>

using namespace std;
const int mod = 1000000007;
int n;
long a[300000];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  
  long sum = 0;
  long base = 1;
  for (int k = 0; k < 62; ++k) {
    long c[2] = {};
    for (int i = 0; i < n; ++i) {
      int d = (a[i] >> k) & 1;
      ++c[d];
    }
    sum = (sum + c[0] * c[1] % mod * base) % mod;
    base = (base * 2) % mod;
  }
  cout << sum << endl;
}