#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  long long int sum = 0;
  for (long long int i = 0; i < 100; i++) {
    long long int zc = 0;
    long long int oc = 0;
    long long int idsum = 0;
    for (long long int j = 0; j < n; j++) {
      if (a[j] % 2 == 0)
        zc++;
      else
        oc++;
      a[j] /= 2;
    }
    idsum = oc * zc * pow(2, i);
    sum += idsum;
    if (sum >= 1000000007) sum = sum % 1000000007;
  }
  sum = sum % 1000000007;
  cout << sum << endl;
}
