#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int N;
int main() {
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  long long ans = 0;
  vector<int> ones(60, 0);
  for (int i = 0; i < N; i++)
    for (int j = 0; j < 60; j++) {
      if (A[i] & (1ll << j)) ones[j]++;
    }
  for (int i = 0; i < 64; i++) {
    ans += (long long)((ones[i]) * (N - ones[i]) * pow(2, i));
  }
  ans = ans % mod;
  cout << ans << endl;
  return 0;
}
