#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template <class T>
ostream &operator<<(ostream &o, const vector<T> &v) {
  o << "{";
  for (int i = 0; i < (int)v.size(); i++) o << (i > 0 ? ", " : "") << v[i];
  o << "}";
  return o;
}
int main() {
  vector<int> zero(60);
  vector<int> one(60);
  int n;
  cin >> n;
  lint x, tmp, ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    for (int j = 0; j < 60; j++) {
      tmp = x % 2;
      if (tmp == 0)
        zero[j]++;
      else
        one[j]++;
      x /= 2;
    }
  }
  tmp = 1;
  for (int i = 0; i < 60; i++) {
    ans += (zero[i] * one[i] % 1000000007) * tmp;
    ans %= 1000000007;
    tmp = tmp * 2 % 1000000007;
  }
  cout << ans << "\n";
}
