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