#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const long long mod = 1e9 + 7;
int n;
int cnt[60][2];
long long a[N], p2[64];
int main() {
  cin >> n;
  p2[0] = 1;
  for (int i = 1; i <= 60; ++i) p2[i] = (p2[i - 1] * 2) % mod;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    for (int j = 0; j < 60; ++j)
      if (a[i] & (1LL << j))
        cnt[j][1]++;
      else
        cnt[j][0]++;
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 60; ++j)
      if (a[i] & (1LL << j))
        cnt[j][1]--;
      else
        cnt[j][0]--;
    for (int j = 0; j < 60; ++j)
      if (a[i] & (1LL << j)) {
        ans += p2[j] * cnt[j][0];
        ans %= mod;
      } else {
        ans += p2[j] * cnt[j][1];
        ans %= mod;
      }
  }
  cout << ans << endl;
}
