#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  int64_t a[n];
  for (int i = 0; i < n; ++i) cin >> a[i];
  long long ans = 0;
  long long soul = 1;
  for (int j = 1; j <= 65; ++j) {
    long long count_e = 0, count_o = 0;
    for (int i = 0; i < n; ++i) {
      if (a[i] & 1)
        count_o++;
      else
        count_e++;
      a[i] = (a[i] >> 1);
    }
    ans = (ans + count_e * count_o * soul) % 1000000007;
    soul = (soul * 2) % 1000000007;
  }
  cout << ans;
}
