#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007LL;
int main(void) {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  long long ans = 0;
  for (int i = 0; i < 60; ++i) {
    int a0 = 0;
    int a1 = 0;
    for (int j = 0; j < N; ++j) {
      if (A[j] & (1LL << i))
        a1++;
      else
        a0++;
    }
    int tmp = a1 * a0 % mod;
    for (int j = 0; j < i; ++j) {
      tmp = 2 * tmp % mod;
    }
    ans += tmp % mod;
  }
  ans = ans % mod;
  cout << ans << endl;
  return 0;
}
