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