#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<int> A1(100);
  for (int i = 0; i < (int)(N); i++) {
    int64_t a;
    cin >> a;
    bitset<100> a_bit(a);
    int j = 0;
    while (a_bit.any()) {
      if (a_bit.test(0)) A1.at(j)++;
      j++;
      a_bit >>= 1;
    }
  }
  int64_t ans = 0, m = 1;
  for (int i = 0; i < (int)(100); i++) {
    ans = (ans + A1.at(i) * (N - A1.at(i)) * m) % INF;
    m = m * 2 % INF;
  }
  cout << ans << endl;
}
