#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < (int)n; i++) cin >> a[i];
  long long ans = 0;
  long long p = 1;
  for (int i = 0; i < (int)61; i++) {
    int sum1 = 0;
    for (int j = 0; j < (int)n; j++) {
      if (a[j] & (1LL << i)) sum1++;
    }
    ans += (sum1 * (n - sum1) % MOD) * p;
    ans %= MOD;
    p *= 2;
    p %= MOD;
  }
  cout << ans << endl;
  return 0;
}
