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