#include <bits/stdc++.h>
using namespace std;
const bool DEBUG = true;
int main() {
  long long n;
  cin >> n;
  vector<bitset<60> > v(n);
  for (int i = 0; i < n; i++) {
    long long p;
    cin >> p;
    v[i] = bitset<60>(p);
  }
  vector<long long> cnt(60);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      if (v[i][j] == 1) cnt[j]++;
    }
  }
  long long pow2 = 1;
  long long ans = 0;
  for (long long i = 0; i < 60; i++) {
    long long num1 = cnt[i];
    long long num0 = n - cnt[i];
    long long tmp = (num0 * num1) * pow2;
    tmp %= 1000000007;
    ans += tmp;
    ans %= 1000000007;
    pow2 *= 2;
    pow2 %= 1000000007;
  }
  cout << ans << endl;
}
