#include <bits/stdc++.h>
using namespace std;
long long arr[1000000], powers[100];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  powers[0] = 1;
  for (int i = 1; i <= 60; i++) {
    powers[i] = (powers[i - 1] * 2) % (long long)1000000007;
  }
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  long long sum = 0;
  for (long long i = 0; i < 60; i++) {
    long long oc = 0, zc = 0;
    for (long long j = 0; j < n; j++) {
      if (arr[j] % 2 == 0) {
        zc++;
      } else {
        oc++;
      }
      arr[j] = arr[j] / 2;
    }
    sum = (sum + (zc * oc * powers[i]) % (long long)1000000007) %
          (long long)1000000007;
  }
  cout << sum;
}
