#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  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 zero = 0, one = 0;
    for (int j = 0; j < n; ++j) {
      if (a[j] & (1ll << i)) {
        one++;
      } else {
        zero++;
      }
    }
    long long res = (zero * one) % 1000000007;
    res = (res * (1ll << i)) % 1000000007;
    ans = (ans + res) % 1000000007;
  }
  cout << ans << endl;
  return 0;
}
