#include <bits/stdc++.h>
using namespace std;
const int M = pow(10, 9) + 7;
class mll {
 public:
  long long x;

 public:
  mll(long long x = 0) : x((x % M + M) % M){};
  void operator+=(const mll& a) {
    if ((x += a.x) >= M) x -= M;
  }
  void operator*=(const mll& a) { (x *= a.x) %= M; }
  mll operator+(const mll& a) {
    *this += a;
    return *this;
  }
  mll operator*(const mll& a) {
    *this *= a;
    return *this;
  }
};
bool IsOneBit(long long bits, int i) { return (bits & (1ll << i)) > 0; }
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  long long AMax = 0;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    AMax = max(A[i], AMax);
  }
  int digit = log2(AMax);
  mll ans = 0;
  for (int i = 0; i <= digit; i++) {
    long long one = 0, zero = 0;
    for (long long a : A) {
      if (IsOneBit(a, i))
        one++;
      else
        zero++;
    }
    ans += (1ll << i) * one * zero;
  }
  cout << ans.x << endl;
}
