#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<long long> a(n + 1, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  long long ret = 0;
  for (int i = 60; i >= 0; i--) {
    int num1 = 0;
    ret = ret << 1;
    for (int j = 0; j < n; j++) {
      if (a[j] >> i & 1) num1++;
    }
    ret = ret + num1 * (n - num1);
    ret %= MOD;
  }
  cout << ret << endl;
  return 0;
}
