#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  long long a[n];
  int i, j;
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  int A[n][64];
  for (i = 0; i < n; i++) {
    for (j = 0; j < 64; j++) {
      A[i][j] = 0;
    }
  }
  for (i = 0; i < n; i++) {
    long long temp = a[i];
    int count = 0;
    while (temp > 0) {
      A[i][63 - count] = (temp % 2);
      temp /= 2;
      count++;
    }
  }
  long long sum = 0;
  for (j = 63; j >= 0; j--) {
    int zero = 0;
    for (i = 0; i < n; i++) {
      if (A[i][j] == 0) {
        zero++;
      }
    }
    long long power1 = (long long)pow(2, 63 - j) % mod;
    long long power2 = (zero * ((n - zero) * power1) % mod) % mod;
    sum = ((sum % mod) + (power2 % mod)) % mod;
  }
  cout << sum << "\n";
  return 0;
}
