#include <bits/stdc++.h>
using namespace std;
unsigned long long int allXor(unsigned long long int a[], int n) {
  long long int mod = 1000000007;
  unsigned long long int r = 0;
  for (int i = 0; i < 61; i++) {
    long long int zero, one;
    zero = one = 0;
    unsigned long long int sum = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] % 2 == 0)
        zero++;
      else
        one++;
      a[j] /= 2;
    }
    unsigned long long int k = ((unsigned long long)(1 << i)) % mod;
    unsigned long long int temp = ((unsigned long long int)zero * one) % mod;
    sum = (temp * k) % mod;
    r = (r + sum) % mod;
  }
  return r;
}
int main() {
  int n;
  cin >> n;
  unsigned long long int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  unsigned long long int sum = allXor(a, n);
  cout << sum << "\n";
  return 0;
}
