#include <bits/stdc++.h>
using namespace std;
typedef struct {
  int odd;
  int even;
} NUM;
unsigned long long mod = 1000000007;
int main(void) {
  int N;
  NUM digit[60] = {0, 0};
  cin >> N;
  for (int i = 0; i < N; i++) {
    unsigned long long A;
    cin >> A;
    for (int j = 0; j < 60; j++) {
      if ((A >> j) & 1)
        digit[j].odd++;
      else
        digit[j].even++;
    }
  }
  unsigned long long sum = 0;
  for (int i = 0; i < 60; i++) {
    sum += digit[i].odd * digit[i].even % mod * ((1LL << i) % mod) % mod;
    sum %= mod;
  }
  cout << sum << endl;
}
