#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  uint64_t p = 1000000007;
  cin >> N;
  uint64_t A[300000];
  int b[60];
  for (int i = 0; i < 60; i++) {
    b[i] = 0;
  }
  for (int n = 0; n < N; n++) {
    cin >> A[n];
    for (int i = 0; i < 60; i++) {
      if (A[n] & (0x01ULL << i)) {
        b[i]++;
      }
    }
  }
  uint64_t res = 0;
  for (int i = 0; i < 60; i++) {
    res += (N - b[i]) * b[i] % p * (0x01ULL << i) % p;
    res %= p;
  }
  cout << res << endl;
  return 0;
}
