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