#include <bits/stdc++.h>
using namespace std;
int MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  long long int tmp;
  int a[60];
  for (int i = 0; i < (n); i++) a[i] = 0;
  for (int i = 0; i < n; i++) {
    cin >> tmp;
    for (int i = 0; i < 60; i++) {
      if (tmp & (1ll << i)) {
        a[i]++;
        cout << "i=" << i << endl;
      }
    }
  }
  long long int sum = 0;
  for (int i = 0; i < 60; i++) {
    long long int aa = (1ll << i) % MOD;
    sum += (((aa * a[i]) % MOD) * (n - a[i]));
    sum %= MOD;
  }
  cout << sum << endl;
}
