#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    long long x = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] >> i & 1) x++;
    }
    long long now = x * (n - x) % 1000000007;
    for (int j = 0; j < i; j++) {
      now = now * 2 % 1000000007;
    }
    cout << "now: " << now << " ";
    ans += now;
    ans %= 1000000007;
    cout << "ans: " << ans << endl;
  }
  cout << ans << endl;
}
