#include <bits/stdc++.h>
using namespace std;
int MOD = 1000 * 1000 * 1000 + 7;
int main() {
  long long n;
  cin >> n;
  long long arr[62];
  memset(arr, 0, sizeof arr);
  for (int X = 0; X < n; X++) {
    long long x;
    cin >> x;
    for (long long i = 0; i < 62; i++) {
      if (x & (1ll << i)) arr[i]++;
    }
  }
  long long p2[62];
  p2[0] = 1;
  for (int i = 1; i < 62; i++) {
    p2[i] = p2[i - 1] * 2ll;
  }
  long long sm = 0;
  for (int i = 0; i < 62; i++) {
    sm += p2[i] * (arr[i] * (n - arr[i]));
    sm = sm % MOD;
  }
  cout << sm << endl;
}
