#include <bits/stdc++.h>
using namespace std;
unsigned long long mod = 1e9 + 7;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, a[60] = {0};
  unsigned long long s = 0, fu = 1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    unsigned long long t, k = 0;
    cin >> t;
    while (t > 0) {
      if (t & 1) a[k]++;
      k++, t /= 2;
    }
  }
  for (int i = 0; i < 60; i++) {
    if (a[i] == 0) continue;
    s += (((unsigned long long)a[i] * (unsigned long long)(n - a[i]) % mod) *
          fu) %
         mod;
    s %= mod;
    fu *= 2;
  }
  cout << s << endl;
  return 0;
}
