#include <bits/stdc++.h>
using namespace std;
int64_t mod = 1000000007;
int main() {
  int64_t n, i, j, ans = 0;
  cin >> n;
  vector<int64_t> a(n), c(60), p2(60);
  for (i = 0; i < n; i++) {
    cin >> a.at(i);
    bitset<60> b(a.at(i));
    for (j = 0; j < 60; j++) {
      if (b.test(j)) c.at(j)++;
      if (j == 0)
        p2.at(j) = 1;
      else
        p2.at(j) = 2 * p2.at(j - 1) % mod;
    }
  }
  for (j = 0; j < 60; j++)
    ans = (ans + p2.at(j) * c.at(j) * (n - c.at(j))) % mod;
  cout << ans << endl;
}
