#include <bits/stdc++.h>
const long long int MOD = 1e9 + 7;
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n], sum = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= 60; i++) {
    long long int nol = 0, satu = 0;
    long long int idsum = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] % 2 == 0) {
        nol++;
      } else {
        satu++;
      }
      a[j] /= 2;
    }
    idsum = nol * satu * 1 << i;
    sum += idsum;
    sum %= MOD;
  }
  cout << sum << endl;
}
