#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int N;
bitset<60> A[300000 + 1];
int main() {
  cin >> N;
  for (int i = 0; i < (int)N; i++) {
    int64_t x;
    cin >> x;
    A[i] = bitset<60>(x);
  }
  int64_t ans = 0;
  for (int i = 0; i < 60; i++) {
    int64_t count = 0;
    for (int j = 0; j < N; j++) {
      if (A[j].test(i)) count++;
    }
    ans += (1LL << i) * (count * (N - count));
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
