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