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