#include <bits/stdc++.h>
using namespace std;
long long int arr[1000000];
long long int func(int p) {
  long long int ans = 1;
  if (p == 0) return 1;
  for (int i = 1; i <= p; i++) {
    ans =
        ((ans % (long long int)1000000007) * (2 % (long long int)1000000007)) %
        (long long int)1000000007;
  }
  return ans;
}
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 < 64; 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 % (long long int)1000000007) +
           (zc * oc * func(i)) % (long long int)1000000007) %
          (long long int)1000000007;
  }
  cout << sum;
}
