#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int main(void) {
  int N;
  cin >> N;
  long long A[N];
  for (int i = 0; i < N; i++) cin >> A[i];
  long long ans = 0;
  long long ruiseki[120] = {};
  for (int i = 0; i < N; i++) {
    long long val = 1;
    for (int j = 0; j < 60; j++) {
      if ((val & A[i]) == val) {
        ruiseki[(j << 1)]++;
      } else
        ruiseki[(j << 1) + 1]++;
      val <<= 1;
    }
  }
  long long val = 1;
  for (int i = 0; i < 60; i++) {
    ans = (ans +
           (val * (ruiseki[(i << 1)] * ruiseki[(i << 1) + 1] % mod) % mod)) %
          mod;
    val <<= 1;
  }
  cout << ans << endl;
  return 0;
}
