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