#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long int sumXOR(long long int arr[], int n) {
  long long int sum = 0;
  for (int i = 0; i < 60; i++) {
    int zc = 0, oc = 0;
    long long int idsum = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = (oc * zc * (1ll << i) + mod) % mod;
    sum = (sum + idsum) % mod;
  }
  return (sum + mod) % mod;
}
int main() {
  int n;
  cin >> n;
  long long int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long int sum = sumXOR(arr, n);
  cout << sum;
  return 0;
}
