#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)1e6 + 5;
const long long mod = (long long)1e9 + 7;
long long a[maxn];
bool b[maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = (int)1; i <= (int)n; i++) cin >> a[i];
  int t = 60;
  long long b = 1;
  long long ans = 0;
  while (t--) {
    long long zero = 0, one = 0;
    for (int i = (int)1; i <= (int)n; i++) {
      if (a[i] & 1)
        one++;
      else
        zero++;
      a[i] >>= 1;
    }
    ans += one * zero % mod * b % mod;
    ans %= mod;
    b <<= 1;
  }
  cout << ans << endl;
}
