#include <bits/stdc++.h>
using namespace std;
long long a[300010], b[70][2], ans;
int main(void) {
  int N;
  cin >> N;
  for (int i = 1; i <= N; i++) cin >> a[i];
  for (int i = 1; i <= N; i++) {
    int raod = 0;
    while (a[i]) {
      raod++;
      b[raod][a[i] % 2]++;
      a[i] = a[i] / 2;
    }
    for (int j = raod + 1; j <= 60; j++) b[j][0]++;
  }
  int j = 1;
  for (int i = 1; i <= 63; i++) {
    ans += ((b[i][1] % 1000000007) * (b[i][0] % 1000000007)) % 1000000007 *
           (j % 1000000007);
    ans %= 1000000007;
    j *= 2;
  }
  cout << ans % (1000000007) << endl;
  return 0;
}
