#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
const int MOD = 1000000007;
const int MAX = 100000;
int even[60], odd[60];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < 60; i++) {
    even[i] = 0;
    odd[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    long long a;
    cin >> a;
    for (int j = 0; j < 60; j++) {
      if (a & 1LL << j)
        odd[j]++;
      else
        even[j]++;
    }
  }
  long long ans = 0;
  for (int i = 0; i < 60; i++) {
    long long tmp = odd[i] * even[i];
    for (int j = 0; j < i; j++) {
      tmp = (tmp * 2) % MOD;
    }
    ans = (ans + tmp) % MOD;
  }
  cout << ans << endl;
}
