#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long mod = pow(10, 9) + 7;
  long ans = 0;
  vector<int> d(60, 0);
  for (int i = 0; i < n; i++) {
    long a;
    cin >> a;
    stringstream ss;
    ss << bitset<60>(a);
    string s = ss.str();
    for (int j = 0; j < 60; j++) {
      if (s[j] == '1') {
        d[j] += 1;
      }
    }
  }
  for (int j = 0; j < 60; j++) {
    ans += pow(2, (59 - j)) * d[j] * (n - d[j]);
    ans %= mod;
  }
  cout << ans << endl;
}
