#include <bits/stdc++.h>
using namespace std;
long long n, a[500009], b[61], c[61], x;
unsigned long long ans, sum;
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; i++) {
    x = a[i];
    for (int j = 0; j <= 60; j++) {
      if (x & 1)
        b[j]++;
      else
        c[j]++;
      x = (x >> 1);
    }
  }
  x = 1;
  for (int i = 0; i <= 60; i++) {
    sum = b[i] * c[i];
    sum %= 1000000007;
    sum *= x;
    sum %= 1000000007;
    ans += sum;
    ans %= 1000000007;
    x = (x << 1);
  }
  cout << ans << endl;
  return 0;
}
