#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int bit[n][60];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      bit[i][j] = a[i] % 2;
      a[i] = a[i] >> 1;
    }
  }
  int count[60] = {};
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      if (bit[i][j] == 1) {
        count[j]++;
      }
    }
  }
  const long long DIV = 1000000007;
  long long ans = 0;
  long long base = 1;
  for (int i = 0; i < 60; i++) {
    ans += (count[i] * (n - count[i]) * base) % DIV;
    base = (base * 2) % DIV;
  }
  ans = ans % DIV;
  cout << ans << endl;
  return 0;
}
