#include <bits/stdc++.h>
using namespace std;
int main() {
  const int mod = 1000000007;
  int n;
  cin >> n;
  long long a[n];
  int b0[61] = {}, b1[61] = {};
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j <= 60; j++) {
      if (a[i] % 2)
        b1[j]++;
      else
        b0[j]++;
      a[i] /= 2;
    }
  }
  long long p = 1, x = 0;
  long long b[61] = {};
  for (int i = 0; i <= 60; i++) {
    b[i] = b0[i] * b1[i];
    b[i] %= mod;
    x += b[i] * p;
    p *= 2;
    x %= mod;
    p %= mod;
  }
  cout << x << endl;
  return 0;
}
