#include <bits/stdc++.h>
using namespace std;
template <class A>
void pr(A a) {
  cout << (a) << endl;
}
template <class A, class B>
void pr(A a, B b) {
  cout << a << " ";
  pr(b);
}
template <class A, class B, class C>
void pr(A a, B b, C c) {
  cout << a << " ";
  pr(b, c);
}
template <class A, class B, class C, class D>
void pr(A a, B b, C c, D d) {
  cout << a << " ";
  pr(b, c, d);
}
template <class T>
inline bool chmin(T &a, T b) {
  return a > b ? a = b, true : false;
}
template <class T>
inline bool chmax(T &a, T b) {
  return a < b ? a = b, true : false;
}
template <int Mod>
struct ModInt {
  long long x;
  ModInt() : x(0) {}
  ModInt(long long sig) {
    int sigt = sig % Mod;
    if (sigt < 0) sigt += Mod;
    x = sigt;
  }
  int get() const { return (int)x; }
  ModInt &operator+=(ModInt that) {
    if ((x += that.x) >= Mod) x -= Mod;
    return *this;
  }
  ModInt &operator-=(ModInt that) {
    if ((x += Mod - that.x) >= Mod) x -= Mod;
    return *this;
  }
  ModInt &operator*=(ModInt that) {
    x = (unsigned long long)x * that.x % Mod;
    return *this;
  }
  ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
  ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
  ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
  friend ostream &operator<<(ostream &stream, const ModInt &that) {
    return stream << that.x;
  }
};
int main(void) {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < int(N); ++i) {
    cin >> A[i];
  }
  ModInt<((long long)(1e9 + 7))> ans;
  for (int i = 0; i < int(61); ++i) {
    int i0 = 0;
    int i1 = 0;
    for (int j = 0; j < int(N); ++j) {
      if (A[j] & (long long)(1LL << i))
        i1++;
      else
        i0++;
    }
    ModInt<((long long)(1e9 + 7))> tmp((1LL << i));
    ans += ModInt<((long long)(1e9 + 7))>(i0 * i1) *
           ModInt<((long long)(1e9 + 7))>(1LL << i);
  }
  pr(ans);
}
