#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 7;
const long long MOD = 1e9 + 7, UM = 1;
long long a[MAXN], poten[62], um[62], zer[62];
inline long long soma_mod(long long x, long long y) { return (x + y) % MOD; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  poten[0] = 1;
  for (int i = 1; i < 60; i++) poten[i] = (2LL * poten[i - 1]) % MOD;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    for (long long j = 0; j < 60; j++) {
      if (((UM << j) & a[i]))
        um[j]++;
      else
        zer[j]++;
    }
  }
  long long ans = 0;
  for (int i = 1; i <= n - 1; i++) {
    for (long long j = 0; j < 60; j++) {
      ans = soma_mod(ans, poten[j] * ((um[j] * zer[j]) % MOD));
    }
  }
  cout << ans << endl;
}
