#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, ans = 0LL, x;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < 60; i++) {
    int c = 0;
    for (int j = 0; j < n; j++) {
      if ((a[j] & (1 << i)) != 0LL) c++;
    }
    ans += (1 << i) * (c) * (n - c);
    ans %= 1000000007;
  }
  cout << ans % 1000000007 / 2 << endl;
  return 0;
}
