#include <bits/stdc++.h>
using namespace std;
const int N_MAX = 3 * 100000;
const unsigned long long MOD = 1000000007;
int main() {
  int N;
  unsigned long long A[N_MAX];
  int cnt[60] = {0};
  unsigned long long ans = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (int i = 0; i < 60; i++) {
    int one = 0;
    int zero = 0;
    for (int j = 0; j < N; j++) {
      if ((A[j] >> i) & 1ULL)
        one++;
      else
        zero++;
    }
    ans = (ans + (1ULL << i) * one * zero % MOD) % MOD;
  }
  cout << ans << endl;
  return 0;
}
