#include <bits/stdc++.h>
using namespace std;
int N;
long long A[100], x;
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> x;
    for (int i = 0; i < 60; i++) {
      long long temp = x & (1LL << i);
      if (temp) A[i]++;
    }
  }
  for (int i = 0; i < 60; i++) {
    A[i] = A[i] * (N - A[i]);
  }
  for (int i = 1; i <= 60; i++) {
    A[i] = A[i] + (A[i - 1] >> 1);
    A[i - 1] = A[i - 1] & 1;
  }
  for (int i = 0; i < 60; i++) {
    A[i] %= 1000000007;
  }
  long long p2 = 1;
  long long ans = 0;
  for (int i = 0; i <= 60; i++) {
    ans = (ans + A[i] * p2) % 1000000007;
    p2 *= 2;
    p2 %= 1000000007;
  }
  cout << ans;
  return 0;
}
