#include <bits/stdc++.h>
using namespace std;
int N;
signed long long A[303030];
signed long long mo = 1000000007;
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N;
  for (i = 0; i < (N); i++) cin >> A[i];
  signed long long ret = 0;
  for (i = 0; i < (60); i++) {
    int C[2] = {};
    for (j = 0; j < (N); j++) C[(A[j] >> i) & 1]++;
    signed long long num = C[0] * C[1] % mo;
    signed long long s = (1LL << i) % mo;
    (ret += num * s) %= mo;
  }
  cout << ret << endl;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  cout.tie(0);
  solve();
  return 0;
}
