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