#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<int> a(61, 0);
  long long int r = 0;
  for (int i = 0; i < n; i++) {
    cin >> r;
    for (int j = 0; j < 61; j++) {
      a[j] += ((r >> j) & 1);
    }
  }
  long long int sum = 0, t = 0;
  long long int s = 0;
  for (int i = 0; i < 61; i++) {
    t = ((long long int)1 << i) % mod;
    s = (a[i] * (n - a[i])) % mod;
    sum += (t * s) % mod;
    sum %= mod;
  }
  cout << sum << endl;
  return 0;
}
