#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int inf = 1000000007;
  cin >> n;
  int64_t ans = 0;
  vector<int> data(n);
  for (int i = 0; i < n; i++) {
    cin >> data.at(i);
  }
  for (int i = 0; i < 61; i++) {
    int x = 0;
    int y = n;
    for (int j = 0; j < n; j++) {
      bitset<61> pre(data.at(j));
      if (pre.test(i)) {
        x++;
        y--;
      }
    }
    int64_t as = (x * y) * (1 << i) % inf;
    ans += as;
    ans %= inf;
  }
  cout << ans << endl;
  return 0;
}
