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