#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
const unsigned long long int mod = 1e9 + 7;
unsigned long long int arr[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  unsigned long long int sum = 0;
  for (int i = 0; i < 64; i++) {
    int ola = 0, uber = 0;
    unsigned long long int temp_sum = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j] & 1) {
        ola++;
      } else {
        uber++;
      }
      arr[j] = arr[j] >> 1;
    }
    temp_sum = (uber * (ola * (1 << i)) % mod) % mod;
    sum = (sum + temp_sum) % mod;
  }
  cout << (sum + mod) % mod << '\n';
  return 0;
}
