#include <bits/stdc++.h>
using namespace std;
const int mod = 1e+9 + 7;
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i; i < n; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  int count = 0;
  long long base = 0;
  for (int i = 0; i < 60; i++) {
    base = 1ll << i;
    count = 0;
    for (int j = 0; j < n; j++) {
      if (((a[j] >> i) & 1) == 1) {
        count += 1;
      }
    }
    ans += (base * (count * (n - count)) % mod);
  }
  cout << (ans % mod) << '\n';
  return 0;
}
