#include <bits/stdc++.h>
using namespace std;
constexpr auto BASE = 1000000007;
int N;
vector<long long> A;
int main() {
  cin >> N;
  A = vector<long long>(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  long long m = 60;
  long long ans = 0;
  long long b = 1;
  for (int i = 0; i < m; i++) {
    long long one = 0;
    long long zero = 0;
    for (int j = 0; j < N; j++) {
      if ((A[j] / b) % 2) {
        one++;
      }
    }
    zero = N - one;
    long long t = ((one * zero) * b) % BASE;
    ans = (ans + t) % BASE;
    b *= 2;
  }
  cout << ans << endl;
  return 0;
}
