#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
const int INF = 1e9;
int main() {
  long long n;
  const long long max_n = 3 * 1e5;
  long long a[max_n + 1];
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  long long now = 1;
  for (long long i = 0; i <= 60; i++) {
    long long x = 0;
    for (int j = 0; j < n; j++)
      if (a[j] >> i & 1) x++;
    now = 1;
    for (int j = 0; j < i; j++) {
      now *= 2;
      now %= MOD;
    }
    ans += x * (n - x) * now;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
