#include <bits/stdc++.h>
using namespace std;
void swap(int *a, int *b) {
  int temp = *a;
  *a = *b;
  *b = temp;
}
long long int arr[1000000 + 1000];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long int sum = 0;
  for (int i = 0; i < 60; i++) {
    long long int zc = 0, oc = 0;
    long long int idsum = 0;
    for (long long int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0) {
        zc++;
      } else {
        oc++;
      }
      arr[j] /= 2;
    }
    idsum = oc * zc * (1 << i);
    sum = (sum + idsum) % 1000000007;
  }
  cout << sum;
  return 0;
}
