#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  long long sum = 0;
  for (int d = 0; d < 60; d++) {
    long long n1 = 0;
    long long n0 = 0;
    for (int i = 0; i < N; i++) {
      if ((d << A[i]) & 1)
        n1++;
      else
        n0++;
    }
    long long n = n0 * n1;
    sum += (1ll << d) * n % 1000000007;
  }
  cout << sum % 1000000007;
  return 0;
}
