#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  long ans = 0;
  long mod = 1e9 + 7;
  long base = 1;
  for (int i = 0; i <= 60; i++) {
    int one = 0;
    int zero = 0;
    for (int j = 0; j < N; j++) {
      if (a[j] & 1)
        one++;
      else
        zero++;
      a[j] = a[j] >> 1;
    }
    ans += base * one * zero % mod;
    ans %= mod;
    base *= 2;
    base %= mod;
  }
  cout << ans << endl;
}
