#include <bits/stdc++.h>
using namespace std;
const int maxn = 300000;
int main() {
  long long n;
  long long mod = 1e9 + 7;
  long long ans = 0;
  long long a[maxn];
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long b = 1;
  for (long long i = 0; i < 64; i++) {
    long long c = b;
    b = b * 2;
    long long A = 0, B = 0;
    for (long long j = 0; j < n; j++) {
      long long t = a[j] % b;
      if (c <= t) A++;
    }
    B = n - A;
    ans += (((A * B) % mod) * c) % mod;
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
