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