#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long int arr[300300];
long long int sana[300300];
int main() {
  int n, m, i, j, k, x, y, ans, curr, temp;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  long long int sum = 0;
  for (long long int a = 0; a < 60; a++) {
    long long int one = 0, zero = 0;
    for (j = 1; j <= n; j++) {
      if (arr[j] % 2 == 0) {
        zero++;
      } else {
        one++;
      }
      arr[j] /= 2;
    }
    long long int now = (zero * ((one * (1LL << a)) % mod)) % mod;
    sum = (sum + now) % mod;
  }
  cout << sum << endl;
  return 0;
}
