#include <bits/stdc++.h>
using namespace std;
long long int repow(long long int n, long long int k, long long int m) {
  if (k == 0)
    return 1;
  else if (k % 2 == 1)
    return repow(n, k - 1, m) * n % m;
  else {
    long long int temp = repow(n, k / 2, m);
    return temp * temp % m;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int A, B, C, D, E, F, N, M, K, L, R, X, Y, Z, W, H,
      sum = 0, num = 0, flag = 0;
  string S, T;
  cin >> N;
  vector<vector<long long int>> P(2, vector<long long int>(60, 0));
  for (long long int i = 0; i < N; i++) {
    cin >> A;
    for (long long int j = 0; j < 60; j++) {
      if (A & (1LL << j))
        P[1][j]++;
      else
        P[0][j]++;
    }
  }
  num = N * (N - 1) / 2;
  for (long long int i = 0; i < 60; i++)
    sum += repow(2, i, 1000000007) * (num - (P[1][i] * (P[1][i] - 1) / 2) -
                                      (P[0][i] * (P[0][i] - 1) / 2));
  cout << sum % 1000000007 << endl;
}
