#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int MAX = 1e6;
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};
long long int one[100], zero[100];
bool check(long long int n, long long int pos) { return n & (1ll << pos); }
long long int arr[MAX];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    for (int j = 0; j < 62; j++) {
      if (check(arr[i], j))
        one[j]++;
      else
        zero[j]++;
    }
  }
  long long int temp = n, sum = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 62; j++) {
      if (check(arr[i], j))
        one[j]--;
      else
        zero[j]--;
    }
    for (long long int j = 0; j < 62; j++) {
      if (check(arr[i], j)) {
        sum += (zero[j] * 2ll << j) % MOD;
        sum %= MOD;
      } else {
        sum += (one[j] * 2ll << j) % MOD;
        sum %= MOD;
      }
    }
  }
  cout << sum / 2ll << endl;
  return 0;
}
