#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int bit1[61]{0}, bit0[61]{0};
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 60; j++) {
      if (((arr[i] >> j) & 1) == 1)
        bit1[j]++;
      else
        bit0[j]++;
    }
  }
  long long int sum = 0;
  for (int i = 0; i < 60; i++) {
    sum += (bit0[i] * bit1[i]) * (pow(2, i));
  }
  long long int a = 0;
  long long int b = 0;
  long long int c = 1;
  for (int i = 0; i < 61; i++) {
    b = bit0[i] * bit1[i];
    if (b >= 1000000007) b %= 1000000007;
    b = b * c;
    if (b >= 1000000007) b %= 1000000007;
    a += b;
    if (a >= 1000000007) a %= 1000000007;
    c *= 2;
    if (c >= 1000000007) c %= 1000000007;
  }
  cout << a << endl;
}
