#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int main(void) {
  int N;
  cin >> N;
  long long A[N];
  for (int i = 0; i < N; i++) cin >> A[i];
  long long ans = 0;
  vector<long long> ruiseki[120];
  for (int i = 0; i < 120; i++) ruiseki[i].resize(N, 0);
  for (int i = 0; i < N; i++) {
    long long val = 1;
    for (int j = 0; j < 59; j++) {
      if ((val & A[i]) == val) {
        ruiseki[(j << 1)][i] = 1;
      } else
        ruiseki[(j << 1) + 1][i] = 1;
      val <<= 1;
    }
  }
  for (int i = 0; i < 120; i++) {
    for (int j = N - 1; j > 0; j--) ruiseki[i][j - 1] += ruiseki[i][j];
  }
  long long val = 1;
  for (int i = 0; i < 59; i++) {
    for (int j = 0; j < N - 1; j++) {
      if ((val & A[j]) == val) {
        cout << (val & A[j]) << endl;
        ans = (ans + val * ruiseki[(i << 1) + 1][j + 1]) % mod;
      } else {
        ans = (ans + val * ruiseki[(i << 1)][j + 1]) % mod;
      }
    }
    val <<= 1;
  }
  cout << ans << endl;
  return 0;
}
