#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  int c[20];
  while (cin >> n) {
    memset(c, 0, sizeof(c));
    for (int i = 0; i < n; i++) {
      cin >> x;
      for (int j = 0; j < 20; j++) {
        if (x & (1 << j)) c[j]++;
      }
    }
    long long res = 0;
    for (int i = 0; i < 20; i++) {
      res += (long long)(n - c[i]) * c[i] * (1 << i);
    }
    cout << res % 100000007 << endl;
  }
  return 0;
}
