#include <bits/stdc++.h>
using namespace std;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  vector<int> zero(60), one(60);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    bitset<60> bit(A[i]);
    for (int u = 0; u < 60; u++) {
      if (bit.test(u))
        one[u]++;
      else
        zero[u]++;
    }
  }
  long long ans = 0;
  for (int i = 59; i >= 0; i--) {
    long long cnt = zero[i] * one[i] % 1000000007,
              two = (long long)pow(2, i) % 1000000007;
    long long plus = cnt * two % 1000000007;
    ans += plus;
    ans %= 1000000007;
    if (ans < 0) ans += 1000000007;
  }
  cout << ans << endl;
  return 0;
}
