#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long mul[60];
int main(void) {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = (long long)0; i < (long long)n; i++) {
    cin >> a[i];
  };
  for (long long k = (long long)0; k < (long long)60; k++) {
    if (k == 0)
      mul[k] = 1;
    else
      mul[k] = (mul[k - 1] * 2) % MOD;
  }
  long long ans = 0;
  for (long long k = (long long)0; k < (long long)60; k++) {
    long long zero = 0, one = 0;
    for (long long i = (long long)0; i < (long long)n; i++) {
      if (a[i] & (1 << 0)) {
        one++;
        a[i]--;
      } else {
        zero++;
      }
      a[i] /= 2;
    }
    ans += (long long)mul[k] * (one * zero);
    ans %= MOD;
  }
  cout << ans << "\n";
}
